I'm using LPC55S16-EVK and MCUXpresso SDK version is 2.11.0.
I'm working on a project, in which LPC55s16 needs to act as an SPI slave and continuously receive 32 bytes of data from an ADC. I kept on running into a problem that received data is missing bytes. So I ran a test by filling slaveTxData with zeros and checked the MISO pin and it did not behave as I expected.
SCK is 4 MHz.
I also tried filling slaveTxData with 0x00 to 0x1F. And got this
It's missing some bytes and repeating one of the bytes.
Here's my code:
Thanks for replying!
While I was trying to capture the weird data received by LPC55s16, it seems to be working fine. Strange.
I tried only receiving data from the master and not sending data out. LPC55s16 is acting as a slave to receive data from ADC. Based on my observation, ADC is doing a good job sending data out, while there's a delay in LPC55s16 when receiving data.
The data format ADC sent looked like this:
Start with a byte of header like 0x10 0x11 0x12, followed by 3 bytes of data.
This is what LPC55s16 received from ADC:
The red marks are the headers from ADC and are followed by 3 bytes.
It's missing data from 0x10 to 0x12. Don't know how to fix this situation.
Yes, it seems it missing the first three data, what about the power up sequence? How about first power on slave first? And how about try only send three data.
There is spi-dmi-slave demo under SDK you also can have a look:
From signal picture, it seems from two transfers, it insert other stable data.
How about check your Mater side, master send data to Slave, while slave not send to master immediately, so master receive wrong value.
I made some changes to the code and it starts to show the phenomenon, which received data is missing bytes.
In this figure, there should be 3 bytes of data following 0x13 instead of 2. And the highlighted 0x16, I thought it was repeated, but now I'm wondering if the slave misses 32 bytes so it looks like it's repeated.