I am trying to extract the board address from a BGM111. I do it in BGScript as follows:
and I get 5F541D570B00 which appears to make sense.
I really need to do it in C and found a piece of code that compiles but results in all zeros. The code:
struct gecko_msg_system_get_bt_address_rsp_t *btAddrRsp;
// Extract unique ID from BT Address
btAddrRsp = gecko_cmd_system_get_bt_address();
memcpy(btAddr, btAddrRsp->address.addr, 6);
uniqueId = 0xFFFFFF & *((uint32*) btAddr);
I admit I am not sure I follow this code exactly but when debugging I get all zeros for btAddr and for uniqueId.
Any thoughts or a clearer example of the use of the gecko_cmd_system_get_bt_address function?
>> and I get 5F541D570B00 which appears to make sense.
Try reversing the byte order and you get:
Makes more sense now?
The C code snippet that you attached: this will not work if you call it before the system_boot event has been raised. Could it be possible that you are calling it too early in your program ? (before system_boot) ?
Thanks, that was the problem. I was calling for the address before the boot event.