Part Number: LAUNCHXL-CC1312R1
Other Parts Discussed in Thread: UNIFLASH
Tool/software: TI-RTOS
Hello TI,
could you please help me to read the MAC ID of the cc1312 module.
How we can write same MAC ID into non voltaile memory?
Regards,
kavya
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: LAUNCHXL-CC1312R1
Other Parts Discussed in Thread: UNIFLASH
Tool/software: TI-RTOS
Hello TI,
could you please help me to read the MAC ID of the cc1312 module.
How we can write same MAC ID into non voltaile memory?
Regards,
kavya
You can read the MAC IEEE 802.15.4 address using the following code:
uint64_t macAddrLsb = HWREG(FCFG1_BASE + FCFG1_O_MAC_15_4_0);
uint64_t macAddrMsb =HWREG(FCFG1_BASE + FCFG1_O_MAC_15_4_1);
uint64_t macAddress = (uint64_t)(macAddrMsb << 32) + macAddrLsb;
Hi,
To complete the previous answer, you can also read the MAC address of your device using Uniflash. Once you have connected your device, go to the “Settings & Utilities” tab, scroll down and read the address (you can as well read/write the secondary address).
Regards,
Hello TI,
Thanks for the reply.
I am using format specifier to print the mac address.
example:Display_printf(display, 0, 0,"Mac ID =%d", macAddress); (tried %04d,%08d ,%16d getting same value)
I have tried %x also... i am getting he result as 1caa5adb.
Regards,
kavya
Hi Kavya,
FYI: 480926427 = 0x1CAA5ADB (which corresponds to the 4 last bytes of your MAC address).
Now, you basically need to get the 4 missing bytes of the address (maybe you need to store the two parts of the address in two uint32 instead of one uint64) and print the number in hexadecimal format (using %x or %X format in Display_printf()). To obtain the format XX: XX: XX: XX: XX: XX: XX: XX, you will need to print the data byte per byte using a mask.
Regards,
Hello TI,
uint64_t macAddrLsb = HWREG(FCFG1_BASE + FCFG1_O_MAC_15_4_0);
uint64_t macAddrMsb =HWREG(FCFG1_BASE + FCFG1_O_MAC_15_4_1);
uint64_t macAddress = (uint64_t)(macAddrMsb << 32) + macAddrLsb;
The above code only prints the 4 bytes of the macAddrLsb. I wanted to print full mAC ID .(ex:1caa5adb.)
I have tried so many ways..but its not printing.could you please help me to solve this issue.
Regards,
kavya
Hi,
The solution is exactly as I suggested before:
uint32_t macAddrLsb = HWREG(FCFG1_BASE + FCFG1_O_MAC_15_4_0);
uint32_t macAddrMsb =HWREG(FCFG1_BASE + FCFG1_O_MAC_15_4_1);
Display_printf(hSerial, 1, 0, "%x", macAddrMsb);
Display_printf(hSerial, 2, 0, "%x", macAddrLsb);
This will print (for me):
1ca610ef 124b5218
Regards,
kavya dn Your problem is on Display_printf. The "%x" in Display_printf only take 4bytes to display so you cannot use uint64_t on it. Otherwise, it will be truncate to 4 bytes and that's why you only see lower 4 bytes. Please refer to Clément's code to display high/low 4 bytes of MAC address separately.
Hi again,
Good to see that you solved your problem.
To write in non volatile memory, please read the following threads:https://e2e.ti.com/support/wireless-connectivity/bluetooth/f/538/t/635326 and https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz/f/156/t/806464
Hi,
You have two ways to modify the secondary MAC address of your device:
1- Using Uniflash (still in the tab "Settings & Utilities")
2- Modifying the value in the ccfg.c file. You can basically modify the following lines:
//##################################### // Alternative IEEE 802.15.4 MAC address //##################################### #ifndef SET_CCFG_IEEE_MAC_0 #define SET_CCFG_IEEE_MAC_0 0xFFFFFFFF // Bits [31:0] #endif #ifndef SET_CCFG_IEEE_MAC_1 #define SET_CCFG_IEEE_MAC_1 0xFFFFFFFF // Bits [63:32] #endif
After this, you can use the following code to read the secondary MAC address:
uint32_t macAddrLsb_ = HWREG(CCFG_BASE + CCFG_O_IEEE_MAC_0);
uint32_t macAddrMsb_ = HWREG(CCFG_BASE + CCFG_O_IEEE_MAC_1);
Display_printf(hSerial, 1, 0, "%x", macAddrMsb_);
Display_printf(hSerial, 2, 0, "%x", macAddrLsb_);
Best regards,
hello TI,
I was not able to write secondary MAC address through uniflash tool.It is showing the below error.
Error!
Error: Expected MAC address length of 8 bytes.
successfully able to add code in ccfg.c file. I can able to read secondary mac address.
could you please provide the code how we can write into secondary MAC address.
Regards,
kavya
Hi,
I don't understand what you are asking for: the code to modify secondary MAC address was already provided to you in this thread (it consisted in modify the content of ccfg.c file).
By the way don't forget to click "This Resolved my issue" when an answer helps you, this will keep people keen to help you.
Best regards,