This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Thread reading peer_address fields

Hey,

For my project I am working on I am using openThread to multicast when a Thingy52 connects to a nRF52840. The nRF52840 (central) connects with a Thingy52 (peripheral) using BLE. I store the BLE MAC address and multicast this, so far so good.

But what I want to do is save the IPv6 peeraddress from the nRF52840 that is connected with the thingy. For this I am reading the otIp6Address from the unit sending the multicast message.

When I read the address something weird happens though, the address is inverted in each index array. Might be really simple but thought I ask for some help.

What I am using to print the address:

printf("Peer address = %X %X %X %X %X %X %X %X \n", peer_address.mFields.m16[0], peer_address.mFields.m16[1] , peer_address.mFields.m16[2], peer_address.mFields.m16[3], peer_address.mFields.m16[4] , peer_address.mFields.m16[5], peer_address.mFields.m16[6], peer_address.mFields.m16[7]);

The result I get is:

   Peer address = DEFD AD EFBE 0 0 FF00 FE 10 

But what it should be is:

FDDE  AD00 BEEF FF FE00 1000

The reason I know this is because of the openThread sniffer I am using which captures this packet:

no.   time                  source                destination  protocol length  info
2116	5208.341551	fdde:ad00:beef::ff:fe00:1000	ff03::1	  CoAP	62	NON, MID:28789, PUT, /connection

So it seems the address is inverted and I am missing some numbers. I might be printing the address wrong or missing something here.

Does anyone have a better way of printing the addresses or can tell me if I am doing something wrong?

Thanks in advance,

ToasTer

Related