Mdek1001 on reading Device id using dwt_readdevid() gives 0xFF as first character


I am using MDEK1001 for my development. I have created a project using nrf SDK 17.02.
I have configured all the pins and peripheral correctly using schematic.
I am porting examples available for DWS1000. I am trying simple tx and rx example.
When I make initalise using “dwt_initialise(DWT_LOADNONE);” api. it will call first “dwt_readdevid();” and this is the point where it is confirmed that all hardware is init correctly. I am receiving 0xFF as a first character later 0x30, 0x01, 0xca, 0xde. instead of 4 bytes I have to read 5 bytes which is not expected. Following is the screen shot of my debug window

is anyone come across such situation so please guide me. I am stuck here.


Posting your code rather than a screen shot of it is more helpful, it lets use see what you are actually doing which we can’t see from a couple of partial lines.

SPI transmits at the same time as receiving. So if I want to send a one byte command and then read 4 bytes I have to send 5 bytes and read 5 bytes. The 5 bytes transmitted are the command followed by 4 bytes of don’t care (normally 0x00). The 5 bytes received are 1 byte of undefined (normally 0xFF (bus idle default value) followed by the 4 bytes of data.

There are two ways to handle this: 1) one is to perform the command and the read as two separate SPI transactions keeping chip select low for the whole time. 2) Perform a single SPI transaction of the total length.

Option 2 is a single command and so in some ways simpler but will result in a number of junk bytes in the Rx buffer equal to the length of the initial command.
From what little I can see of your code I’m guessing that this is what is happening for you.