Hi,
I tested the LPSPI example for S32k146, to add in future the communication with a sd-card via SPI. But it doesn't work. I use PTB0 - PTB3 (LPSPI0). While debugging, it stucks at the while loop in transmit / read function. I attach the functions (init, send, read).
Can anyone help?
Best regards
Sandra
Solved! Go to Solution.
Hello Sandra,
How many of the 128 CLK cycles do you see at the pin?
If you don't read the RX data from the RX FIFO, set CFGR1[NOSTALL].
BR, Daniel
Hi @12914A,
Can you scope the bus?
Is the LPSPI0 sending something on the bus?
How do you call the write_byte() and read_byte() functions?
Regards,
Daniel
Hi Daniel,
thanks for your reply.
The CS and CLK line work as expected. But on the MOSI line there is no data.
Here is how we call the write_byte() function:
for (b = 0 ; b < 0x0f; b++) //Send min 74+ clocks
{ write_byte(0xff);
}
but it stay stuck in the write_byte() in the following line:
while(((LPSPI0->SR & LPSPI_SR_TDF_MASK)>>LPSPI_SR_TDF_SHIFT)==0);
What could be the problem?
Best regards
Sandra
Hello Sandra,
How many of the 128 CLK cycles do you see at the pin?
If you don't read the RX data from the RX FIFO, set CFGR1[NOSTALL].
BR, Daniel