9 months ago.
SPI read value stuck on 0 with nucleo L476RG on MBed
The title says it all. I'm stuck with an issue, where all signals are correct on oscillscop, I should be reading the 0x49FC value, but all I get is 0x0000. I'm using MBED, and still cannot read anything else but zero.
Here's an extract of the code I'm using:
- include "mbed.h"
d1 = 0;
d1 = spiPressure.write(0);
printf("!!!! Init OK %d",d1);
I tried all the 4 modes, despite the fact that mode 1 seems to be the correct one accordingly to the datasheet of the adressed CI, I tried with and without the lock() feature (there's only one device on that SPI port).
As seen below, the conncected SPI slave is responding correctly, but so far d1 is set to 0.
What am I missing ?
3 months, 2 weeks ago.
Christophe, I'm sure you've figured this out by now but if not, then you may have luck using mbed's SPI.transfer() function. It is much more clear in the way it handles the number of bytes written/read and can combine the two operations into one transaction. Good luck!
6 months ago.
Hello Christophe, What kind of SPI sensor are you using? Can you attach the datasheet for the SPI sensor? Can you also explain what does this part of the code do?
and this line: spiPressure.write(W1_CMD);
Thank you, Peter, Mbed Team
To post an answer, please log in.