LPSPI 32bits response and Clock Configuration

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

LPSPI 32bits response and Clock Configuration

ソリューションへジャンプ
2,175件の閲覧回数
Rmpr
Contributor II

Hello,

I want to communication with a sensor using the NXP S32K344 board as the master using LPSPI1. The clock for the spi communication should be 1MHz according to the sensor's datasheet. I need to send an 8bit command and should receive a 32bit response.

 

I configured the clock for 10MHz and sent the command once and in the oscilloscope everything is fine despite not having answers from the sensor. Although when I put the clock at 1MHz the master sends 2 times the command.

 

Clock at 10MHz:

Rmpr_0-1691489123841.png

Clock at 1MHz:

Rmpr_1-1691489203803.png

This is the first problem. The baudrate used for both cases is 100000.

 

I've also defined the SpiDataWidth for 32bits. But I'm not sure how to receive the 32 bits response since the RTD function used "Lpspi_Ip_SyncTransmit" has 8bits array as inputs.

My code:

Lpspi_Ip_SyncTransmit(&SPI_EXTERNAL_DEVICE, Tx_Buffer, Rx_Buffer, NUMBER_OF_BYTES, TIMEOUT);

Tx_Buffer is an uint8 and Rx_Buffer is an uint32.

 

Function Declaration:

Lpspi_Ip_StatusType Lpspi_Ip_SyncTransmit(
                                            const Lpspi_Ip_ExternalDeviceType *ExternalDevice,
                                            uint8 *TxBuffer,
                                            uint8 *RxBuffer,
                                            uint16 Length,
                                            uint32 TimeOut
                                         )

 

 

Also, if I update "Lpspi_Ip_UpdateFrameSize" for 32 bits the programm crashes.

Lpspi_Ip_UpdateFrameSize(&SPI_EXTERNAL_DEVICE, 32U);

 

Thank you.

タグ(3)
0 件の賞賛
返信
1 解決策
2,139件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@Rmpr

Sorry, we overloaded recently,
1. Regarding your first question, I didn't find any abnormality. This may be the reason of your sensor rather than MCU.
2. Rx_Buffer is an uint32, this is not correct, Rx_Buffer should be an 8-bit unsigned array. Secondly, the Frame size should have been set in the configuration interface.

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
2,140件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@Rmpr

Sorry, we overloaded recently,
1. Regarding your first question, I didn't find any abnormality. This may be the reason of your sensor rather than MCU.
2. Rx_Buffer is an uint32, this is not correct, Rx_Buffer should be an 8-bit unsigned array. Secondly, the Frame size should have been set in the configuration interface.

0 件の賞賛
返信
2,121件の閲覧回数
Rmpr
Contributor II
Thank you, I managed to solve the problem
0 件の賞賛
返信