How to Change SPI Baudrate With MCAL

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

How to Change SPI Baudrate With MCAL

Jump to solution
1,618 Views
biyangdong
Contributor II

Hello,I used S32K14X_MCAL4_3_RTM_HF4_1_0_1 Mcal version with Vector Davinci tools, i want change SPI baudrate in runtime,for example,spi_init() with baudrate 3.702Mhz,when one condition satisfied,i want to change the spi baudrate to 10Mhz,is there any api functions or ways in mcal code support this function,i can't find it from AUTOSAR_MCAL_SPI_UM file. the one ways i know from it is that change spi input clock by the api function Spi_SetClockMode.

 

SPI Baudrate.pngSPI Baudrate2.png

Tags (1)
0 Kudos
1 Solution
1,577 Views
namnguyenviet
NXP Employee
NXP Employee

Hello,

Please check whether this node is available in your DaVinci Configurator:

namnguyenviet_0-1617690941302.png

After enabled SpiPhyUnitAlternateClockRef and refer to the MCU clock reference point, I can see SPI_DUAL_CLOCK_MODE is STD_ON. 

namnguyenviet_1-1617691028681.png

However, I'm not sure the same thing happens with DaVinci, cause I don't have DaVinci on hands.

Best Regards,

Nam

 

 

View solution in original post

0 Kudos
4 Replies
1,578 Views
namnguyenviet
NXP Employee
NXP Employee

Hello,

Please check whether this node is available in your DaVinci Configurator:

namnguyenviet_0-1617690941302.png

After enabled SpiPhyUnitAlternateClockRef and refer to the MCU clock reference point, I can see SPI_DUAL_CLOCK_MODE is STD_ON. 

namnguyenviet_1-1617691028681.png

However, I'm not sure the same thing happens with DaVinci, cause I don't have DaVinci on hands.

Best Regards,

Nam

 

 

0 Kudos
1,607 Views
namnguyenviet
NXP Employee
NXP Employee

Yes, by calling Spi_SetClockMode(SPI_ALTERNATE), the SPI baud-rate can be changed to alternate baud-rate value during runtime.

 

0 Kudos
1,591 Views
biyangdong
Contributor II

Thanks for your reply.

but i also have a question,the configuration tools of EB tresos or davinci configurator haven't the configure item SpiEnableDualClockMode in SpiNonAUTOSAR group,the config code in Spi_Cfg.h this functon is off, i cann't to enable it and use,if this to say it is not support in S32K146 chips?

EBTresos configurator item.pngEBTresos configurator.png

 

Davinci configurator item.png

 

 

0 Kudos
1,590 Views
biyangdong
Contributor II

EBTresos configurator code.png

0 Kudos