SPI Setup Menu

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

SPI Setup Menu

跳至解决方案
4,399 次查看
peaces
Contributor III

What can we do to change these settings while running a program on the processor from the SPI setting menu shown in the picture?

Ekran Alıntısı.PNG

0 项奖励
1 解答
4,123 次查看
mariuslucianand
NXP Employee
NXP Employee

Hello @peaces,

I assume that you are using the RDVCU5775EVM because you are not mentioning anywhere the board used.

For that, I've created the following model which is using custom code to change the mentioned parameters. In this case, you don't need to init and reinint the DSPI instance, just to update the parameters directly in the registers as in the below image. You can adjust the code as the sensors you are using requires. 

mariuslucianand_0-1623407939664.png

Now, if you are using the blocking sending, the interrupt priorities must be increased, as I've done in the model using custom code as well. 

Hope this helps,

Marius

 

在原帖中查看解决方案

0 项奖励
12 回复数
4,123 次查看
Baris
Contributor II

@Dong_Luo 

Yes, I am using the RDVCU5775EVM board. The settings made are as in the image, but still, the problem is not solved.

 

system_ubdate.PNG

0 项奖励
4,186 次查看
peaces
Contributor III

@Dong_Luo 

The contents of the system update block are shown in the images called system update.

We made our PCS settings according to the datasheet.

Also, can you share an example with us so that we can get faster results?

0 项奖励
4,151 次查看
Dong_Luo
NXP Employee
NXP Employee

Are you using the RDVCU5775EVM board? For the board, the SPI_2 PCS connection to MSDI and LSD is as the following screenshot shows.

 

nxf47394_0-1623379056736.png

 

Whereas I found your configuration of PCS both are 0, which is not reasonable. here is my configuration.

nxf47394_1-1623379056811.png

 

The MSDI and LSD both need complex drivers on top of SPI drivers. For RDVCU5775EVM, we have no MBDT demo but built an SDK-based demo. 

https://www.nxp.com/design/designs/mpc5775b-bms-and-vcu-reference-design:RDVCU5775EVM

 

nxf47394_2-1623379056854.jpeg

 

0 项奖励
4,225 次查看
peaces
Contributor III

@Dong_Luo 

Hello there,
We wrote the codes in the attached text document into the System Update block and we did not get any results.

 

0 项奖励
4,124 次查看
mariuslucianand
NXP Employee
NXP Employee

Hello @peaces,

I assume that you are using the RDVCU5775EVM because you are not mentioning anywhere the board used.

For that, I've created the following model which is using custom code to change the mentioned parameters. In this case, you don't need to init and reinint the DSPI instance, just to update the parameters directly in the registers as in the below image. You can adjust the code as the sensors you are using requires. 

mariuslucianand_0-1623407939664.png

Now, if you are using the blocking sending, the interrupt priorities must be increased, as I've done in the model using custom code as well. 

Hope this helps,

Marius

 

0 项奖励
4,196 次查看
Dong_Luo
NXP Employee
NXP Employee

@peaces,

What's the context of the System Update block?

If the code in the System Update block executes sequentially, it should add the function of DSPI_Deinit(2) between the two functions of DSPI_MasterInit.

it is recommended to set two different varables for the second parameter in DSPI_MasterInit, like DSPI_MasterInit(2, &spiMasterState_LSD, &spiConfig_LSD) and DSPI_MasterInit(2, &spiMasterState_MSD, &spiConfig_MSD);

Additionally, per the schematic of RDVCU5775EVM, the value of whichPCS in spiConfig_LSD shall be 3, and the value of whichPCS in spiConfig_MSD shall be 1.

nxf47394_0-1623330096693.png

 

 

 

0 项奖励
4,244 次查看
Dong_Luo
NXP Employee
NXP Employee

Hi peaces,

As Marius said, the SPI drivers don't support changing the Clock and Transfer Attributes after initialization for the same SPI instance. 

For the same SPI master to communicate with the slave devices with the different SPI configuration sequence, user needs to call DSPI_Deinit() and then call DSPI_MasterInit() to configure the new attributes (CPOL, CPHA) before transferring the other device. This operation may be a bit inefficient, if caring about the performance, it must directly change the registers.

For the device with the same transfer attributes and different SPI PCS, the SPI drivers provide the function of DSPI_UpdateCS. User just calls it before transmitting.

Hope this helps,

Dong 

 

0 项奖励
4,262 次查看
peaces
Contributor III

Hello @mariuslucianand 

As shown in the picture, there is a System Update block in two different subsystem blocks, and although we trigger these subsystem blocks to work sequentially, the settings cannot be updated and remain at the last configured setting.

Ekran Alıntısı2.PNG

Ekran Alıntısı1.PNG

Ekran Alıntısı.PNG

   

0 项奖励
4,348 次查看
mariuslucianand
NXP Employee
NXP Employee

Hello @peaces,

MBDT generates code on top of the S32SDK and, as far as I know, they don't provide such a function to change the settings during runtime. However, the settings (CPHA and CPOL) are stored in the LPSPI_TCR register, so you can try modifying the register just before using the SPI transmit block. Basically, you have to read the register, change the CPHA and CPOL bits and then update the register with the new value. You can use the S32K memory blocks.

Hope this helps,

Marius

0 项奖励
4,343 次查看
peaces
Contributor III

>>

 

 

0 项奖励
4,385 次查看
peaces
Contributor III

Matlab/Simulink 

0 项奖励
4,389 次查看
davidtosenovjan
NXP TechSupport
NXP TechSupport

Which environment is the screenshot taken from?

0 项奖励