MC3371C operation problem by using [S32 Design Studio for S32 Platform 3.4] for S32k144.

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

MC3371C operation problem by using [S32 Design Studio for S32 Platform 3.4] for S32k144.

791 Views
POSEIDON
Contributor I

I am using NXP's S32k144 chip to implement BMS (Battery Management System).

To control S32k144, design studio provided by NXP is used.
[ S32 Design Studio for ARM v2.2 (previously used) --> S32 Design Studio for S32 Platform 3.4 (currently   used) ]
In addition, NXP's MC33771C is applied as the Battery Cell Controller IC used for BMS.

During the process of implementing the BMS, the following problem occurred.

1. To implement MC33771C, the example file of S32 Design Studio for ARM v2.2 was referred.

2. When implementing the same code in S32 Design Studio for S32 Platform 3.4, it was confirmed that it does not work.

3. As a result of checking why the code does not work in S32 Design Studio for S32 Platform 3.4, it was confirmed that the files created in SDK – Platform – drivers – src – lpspi provided by Design Studio have changed to use SPI communication.

4. In particular, LPSPI_DRV_MasterSetDelay Function is used to use MC33771C, and it was confirmed that the code does not work because the implementation of the function is different in [DS for arm 2.2] and [DS for S32 platform].

[status_t LPSPI_DRV_MasterSetDelay(uint32_t instance, uint32_t delayBetwenTransfers,

uint32_t delaySCKtoPCS, uint32_t delayPCStoSCK)]

Do you have any solutions for this part? Or can you provide example code suitable for S32 Design Studio for S32 Platform 3.4 for operation of MC33771C in s32k144?

 

0 Kudos
Reply
3 Replies

766 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, this function differs between SDK versions. Within RTM3.0.x it calculates LPSPI_CCR parameters based on input values (assumed in microsec) and configured LPSPI functional clock divided by the Prescaler. In RTM4.0.x no calculation is done and you should provide desired values calculated by yourself. 

BR, Petr

0 Kudos
Reply

758 Views
POSEIDON
Contributor I

thank you for your answer. 

how can i calculate the Prescaler in RTM3.0.x?

prescaler = LPSPI_GetClockPrescaler(base);
realDelayBetwenTransfers = delayBetwenTransfers * lpspiState->lpspiSrcClk / s_baudratePrescaler[prescaler] / (uint32_t)MICROSECONDS;

--> RTM3.0.x LPSPI_DRV_MasterSetDelay Function

--> How should i choose the Prescaler for the array of s_baudratePrescaler[prescaler]?

0 Kudos
Reply

709 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

driver provides Prescale value as part of the baud rate calculation, using LPSPI_SetBaudRate function. The value is then used for later programming in the TCR. LPSPI_GetClockPrescaler reads recent TCR value.

BR, Petr

0 Kudos
Reply