S32k146 LPSPI0 doesn't work

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32k146 LPSPI0 doesn't work

Jump to solution
322 Views
12914A
Contributor III

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

Tags (3)
0 Kudos
Reply
1 Solution
214 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

 

View solution in original post

0 Kudos
Reply
3 Replies
286 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply
228 Views
12914A
Contributor III

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

0 Kudos
Reply
215 Views
danielmartynek
NXP TechSupport
NXP TechSupport

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

 

0 Kudos
Reply