LPSPI Chip Select always is LOW (active state)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPSPI Chip Select always is LOW (active state)

ソリューションへジャンプ
3,391件の閲覧回数
MVR
Contributor IV

Hello,

The chip select is always LOW after we send out the first command, it couldn't be in LOW but must be in HIGH (deactivate state), after finish transmission (in this case, after send the 10 bytes):

MVR_0-1669950015569.png

I'm using this configuration:

MVR_1-1669950193535.png

MVR_2-1669950223890.png


I'm using DMA to TX and RX. The DMA callbacks works well.

I'm using as well this function to transfer data:

Lpspi_Ip_AsyncTransmit();

In Lpspi_Ip_UpdateTransferMode I set with LPSPI_IP_INTERRUPT.

Thanks

0 件の賞賛
返信
1 解決策
3,212件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

I haven't noticed but RTD expert found it out. You have a mistake in your configuration.

As LPSPI instance is 0 so you should put Lpspi_Ip_LPSPI_0_IrqTxDmaHandler in DMA interrupt callback:

davidtosenovjan_0-1672750801661.png

Attached modified project.

元の投稿で解決策を見る

0 件の賞賛
返信
13 返答(返信)
3,346件の閲覧回数
MVR
Contributor IV

I debugged the code, when we used DMA, the chip select is always LOW (active state):

Base->TCR is never changed, in the other words, Lpspi_Ip_TxDmaFinishTransfer / Lpspi_Ip_TransferProcess are never called.
 
I initialized the SPI with this way:
MVR_0-1670004686888.png

 

Must I use these callbacks in "IntCtrl_Ip_InstallHandler"? The callback "Dma0_Ch1_IRQHandler" have never changed the Chip Select state, but this function notify that the buffer of DMA about SPI is ok and I can use it.

Another information. When I use simple ISR (the callback "Lpspi_Ip_LPSPI_0_IRQHandler"), the Chip select works according, but I would like to use DMA and not ISR. I saw also I can't use both together.

So, summarize, when I use DMA, there is this problem. The sending, receiving and notify callback of DMA are working well, but the chip select is not working.

I'm using this function to send message:

MVR_1-1670005276624.png

 

0 件の賞賛
返信
3,339件の閲覧回数
MVR
Contributor IV

@davidtosenovjan have you ever seen this problem?

0 件の賞賛
返信
3,334件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

Could you send me the whole project? I mean the whole example how you have configured it showing mentioned behavior. I will try to debug it or report to software developers if needed. Thanks

0 件の賞賛
返信
3,311件の閲覧回数
MVR
Contributor IV

Hello @davidtosenovjan 

Follow the zip with problem using DMA. 

We can see in this code, one example of sending 10 bytes of SPI using DMA, result:

MVR_2-1670867808321.png

MVR_4-1670867836276.png

If we test this code without DMA:

MVR_7-1670867896997.png

We get this result:

MVR_9-1670867946311.png

Thanks!

0 件の賞賛
返信
3,284件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

I just played with this code for quite long time but I haven't found anything wrong.

I guess there is an issue with RTD driver. I will report it and we will see. I will return to you.

0 件の賞賛
返信
3,254件の閲覧回数
MVR
Contributor IV

Ok David, thanks for the help!

I'm waiting for the answer.

0 件の賞賛
返信
3,213件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

I haven't noticed but RTD expert found it out. You have a mistake in your configuration.

As LPSPI instance is 0 so you should put Lpspi_Ip_LPSPI_0_IrqTxDmaHandler in DMA interrupt callback:

davidtosenovjan_0-1672750801661.png

Attached modified project.

0 件の賞賛
返信
3,200件の閲覧回数
MVR
Contributor IV

Ok, but which callback should I use as user callback? Because this "Lpspi_Ip_LPSPI_0_IrqTxDmaHandler" is not available to user, right? I would like to use this callback to do some things.

This "Lpspi_Ip_LPSPI_2_IrqTxDmaHandler" that I defined could be any name, because I'm considering it as an user callback.

Thanks.

0 件の賞賛
返信
3,173件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

You can put SPI_Callback to the transmit function calling where you have NULL pointer

davidtosenovjan_0-1672908311851.png

I am attaching screenshot from some example code for reference

davidtosenovjan_1-1672908473766.png

 

0 件の賞賛
返信
3,163件の閲覧回数
MVR
Contributor IV
Nice David, it worked! Thanks
0 件の賞賛
返信
3,372件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport
0 件の賞賛
返信
3,376件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

Could you specify used S32 Design Studio? Also please clarify which MCU you are using.

0 件の賞賛
返信
3,365件の閲覧回数
MVR
Contributor IV

Ops, I forgot. I'm sorry.

I'm using S32K344 and S32K3 RTD AUTOSAR 4.4 2.0.1 D2207 in S32 Design Studio.

0 件の賞賛
返信