5 Replies Latest reply on Dec 25, 2019 6:23 PM by PY_21

    I see a different mac address show up once in a while if I don’t follow this procedure.

    LaFo_1751236

      The problem I have is I see a different mac address show up once in a while if I don’t follow a specific procedure.  The different mac address is the default from the ble component checkbox.  I turned that off and still see it once in a while.  Here is the way I set the mac address -

       

      1. Write the mac address to userflash row 0 status  = CySysSFlashWriteUserRow(0, &data[0]);
      2. Set device address CyBle_SetDeviceAddress(&cyBle_deviceAddress);//CYBLE_GAP_BD_ADDR_T
      3. Set gapid address CyBle_GapSetIdAddress(&cyBle_deviceAddress);
        • 1. Re: I see a different mac address show up once in a while if I don’t follow this procedure.
          LaFo_1751236

          Here is some additional information -

           

          Here is a question on setting MAC addresses and advertising name.  The problem I have is I see a different mac address show up once in a while if I don’t follow this procedure.

           

          1. 1.  Program the chip.
          2. 2.  Set the antenna id. fwb>setant
          3. 3.  Set the mac. fwb>setmac
          4. 4.  Reboot

           

          I only see it every 1 of 10 times if I just try to set the ant id or mac without starting from a fresh burn.  Here is what it looks like –

           

          Advertising Name -  TH-3000 00171af0aa3a

          FWB>> Compile Date and Time : Oct  8 2019 09:09:07

          Bootloader Version 01.02.20

          App Version 01.11.47

          Advertising Name - TH-3000 00171af0aa3a

           

          Low Power Mode  : DISABLED

          Flow Control    : DISABLED

          BootLoader Bluetooth On, StartAdvertisement - 00a05084934a

          Bootloader Version 01.02.20

          Application Version 01.11.47

          Passkey 0l

           

          Here is what I do to set the mac address and advertising name.

           

          1. Write the mac address to userflash row 0 status  = CySysSFlashWriteUserRow(0, &data[0]);
          2. Set device address CyBle_SetDeviceAddress(&cyBle_deviceAddress);//CYBLE_GAP_BD_ADDR_T
          3. Set gapid address CyBle_GapSetIdAddress(&cyBle_deviceAddress);
          4. Add the model name with the mac address to make an advertising name using this CyBle_GapSetLocalName(Advertising_Name1);
          5. Save the name to row 3 status  = CySysSFlashWriteUserRow(3, &readdata[0]);

           

          So when the program starts and advertises –

           

          1. Reads the advertising name from row 3 and sets it with this call.  CyBle_GapSetLocalName(Advertising_Name1)

          This printout BootLoader Bluetooth On, StartAdvertisement - 00a05084934a  uses call

           

          1. localAddr.type = 0u;

          CyBle_GetDeviceAddress(&localAddr);

          for(i = CYBLE_GAP_BD_ADDR_SIZE; i > 0; i--)

          {

          printf("%2.2x", localAddr.bdAddr[i-1]);

          }

          printf("\r\n");

          • 2. Re: I see a different mac address show up once in a while if I don’t follow this procedure.
            LaFo_1751236

            Adding some clarity.  When the wrong mac is retrieved from the stack, it is from the stack.  Row0 is where the mac address is assigned and did not change.  I have proven that -

             

            1.  Row 0 is the mac address I want.

            2.  Stored it correctly.

            3.  Upon reboot the cypress default mac address is selected by the stack instead of the one I assigned in row 0.  Looking for some switch in the stack the selects either the default mac or the one assigned in row 0. 

            4.  This problem will not happen in the field but just need to make sure I am setting the mac address correctly.

            • 3. Re: I see a different mac address show up once in a while if I don’t follow this procedure.
              LaFo_1751236

              Adding more information -

               

              I see no errors for CyBle_SetDeviceAddress CyBle_GapSetIdAddress.

               

              But upon reboot I see the “default address”.

              I connected with the debugger and see that default address in cyBle_deviceAddress.

               

              I set a breakpoint in the setmac to see the memory after CyBle_SetDeviceAddress CyBle_GapSetIdAddress.

               

              When I re-entered there were 0s past the address and everything went fine.

               

              So I can’t tell which of those 2 calls need all 0s but one does. 

               

              I also saw in the header file that CyBle_GapSetIdAddress was going to be obsoleted. Maybe related.  Who knows.

               

              Entered MAC Address 00171af0aa3a

              Write MAC Address

              SetDevice 0

              GapSetId 0

              MAC Address is - 00171af0aa3a

              Advertising Name -  TH-1000 00171af0aa3a

              FWB>> Compile Date and Time : Nov 13 2019 14:05:18

              Bootloader Version 01.02.20

              App Version 01.11.49

              Advertising Name -  TH-1000 00171af0aa3a

               

              Low Power Mode  : DISABLED

              Flow Control    : DISABLED

              BootLoader Bluetooth On, StartAdvertisement - 00a050000000

              Bootloader Version 01.02.20

              Application Version 01.11.49

              Passkey 0l

              > Compile Date and Time : Nov 13 2019 14:05:18

              Bootloader Version 01.02.20

              App Version 01.11.49

              Advertising Name -  TH-1000 00171af0aa3a

              • 4. Re: I see a different mac address show up once in a while if I don’t follow this procedure.
                PY_21

                Hello,

                 

                Please refer to the KBA link for setting the Bluetooth device address using PSoC4-BLE-SFLASH-Update.exe tool Setting Bluetooth Device Address – KBA211407 .

                Could you please share your project so that we can check at our end ?

                 

                Thanks,

                P Yugandhar.

                • 5. Re: I see a different mac address show up once in a while if I don’t follow this procedure.
                  PY_21

                  Hello LaFo_1751236 ,

                   

                  Could you please share your project ?

                   

                  Thanks,

                  P Yugandhar.