request spi transmit data length, Receive data length, cs pin control.

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

request spi transmit data length, Receive data length, cs pin control.

170 Views
rlaxortn
Contributor IV

i request spi transmit data length, Receive data length, cs pin control.

i am using s32k314 and d32ds, RTD 4.0.0

i wanna communicate mcu and bno080 via spi. 

 

1. after i transmit 2byte(length) and i have to Receive 16byte(length). 

i confim Lpspi_Ip_SyncTransmit. that function have prameter is length. but this length is transmit length and receive length. 

so, if length is different transmit and receive, what dose use function? or other method?

1.png

2.png

2. if i control cs pin for spi, how i do? because i have to input cs pin in spi configure.

but i wanna use cs pin like  digitalWrite(_cs, HIGH);, 

So is there a way to use it without setting the cs pin in the spi settings window?

3.png

Tags (2)
0 Kudos
Reply
1 Reply

161 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

1) SPI is full duplex, so you transmit/receive same number of bytes for each transfer. You can use the full-duplex mode too, you can send 18 bytes in one transfer or split it to two transfers. Discard received bytes for transmit and send dummy bytes for receive operation.

Or you can try half duplex APIs, it can be used even when the module is not configured for a bidirectional single line SPI. A simple test project is in this thread:
https://community.nxp.com/t5/S32K/S32K314-SPI-flash-implementation/m-p/1617504#M21457
It sends one 8bit frame to the Slave device and reads 3 frames from the Slave device.

2) you can configure the used pin as GPIO output in Pins tool and control its assertion as per your need.

BR, Petr

0 Kudos
Reply