how use spi set for using polling and interrupt?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

how use spi set for using polling and interrupt?

309 次查看
rlaxortn
Contributor IV

i am trying to use spi communication with BNO080 chip.

and i am using s32ds version 3.6, RTS is 4.0.0.

mcu is s32k314. 

and i already watched spi examples, so you don't give examples please.

also, i have a s32k344 evb board(172 Pins)

 

1. would you check spi setting is right for using polling spi?

 

a)this is BNO spi Communication Spec. 

3.png

 

b) second picture is my spi configure. i am using spi2. cs pin is pcs0.

1.png

2.png

 

2. when i am using spi polling,  if Lpspi_Ip_SyncTransmit is use, automatically rxbuffer, txbuffer is done? after Lpspi_Ip_SyncTransmit use, i don't need to call other function? 

 

3. i read spi user manual, i find Lpspi_Ip_ManageBuffers() functions.

after i call Lpspi_Ip_SyncTransmit() function, do i have to use Lpspi_Ip_ManageBuffers()  function? how this function use?

 

4. if i use interrupt spi function, how i set spi configure?

it is possible, would you show me pics for setting interrupt spi configure?

 

5. example has only polling and dma interrupt. if i use spi interrupt, i have to use dma?

also, it is possible, would you show me pics for setting interrupt spi configure?

 

I've thought about it a lot and done a lot of testing before asking

and i attach BNO080 Datasheet.

thanks to help.

标记 (2)
0 项奖励
回复
1 回复

278 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

1) SPI mode option (CPHA,CPOL) looks right, you should have SpiDataWidth = 8
2) Lpspi_Ip_SyncTransmit return after transfer is done or timeout happens. You need not to call other function
3) When Sync function is used there is no need to call Lpspi_Ip_ManageBuffers. This should be called periodically when Async function is used in polling mode (default)
4) After Lpspi_Ip_Init function is called, LPSPI_IP_POLLING mode is set as default. To change the default mode Lpspi_Ip_UpdateTransferMode should be called. INTC need to be set as well to enable SPI interrupt.
5) DMA is not needed for interrupt mode. You can refer to below example
https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K312-SPI-Transmit-amp-Receive-Using-Inte...

BR, Petr

0 项奖励
回复