switching the CS Pin of LPSPI (S32K3)

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

switching the CS Pin of LPSPI (S32K3)

Jump to solution
1,934 Views
JoDo
Contributor III

Hello,

I am trying to implement a NXP battery cell controller driver (MC33771C) with a TPL transceiver into a S32K344 controller.

The MC33771C needs a special pattern via the SPI-CS-PIN for wake up, but I could not find, in RTD 1.0.0, a suitable function which I could use for this purpose. 

For the S32K1 controller, for example, there is this function "LPSPI_DRV_SetPcs(LPSPITPLTX,BCC_TX1_LPSPI_PCS,LPSPI_ACTIVE_HIGH);"

Is there a possibility to control the CS pin via RTD or can it only be solved with programming the proper registers in the S32K344?

Thanks!

 

Regard,

JoDo

0 Kudos
1 Solution
1,901 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello JoDo,

I see, thank you.

The driver does not allow that.

And even if it allowed that by re-initializing the whole driver, I don't think you would achieve a precise timing because of the SW overhead.

You can modify the registers of LPSPI module directly.

Or you can disable LPSPI PCS and use the GPIO function of the pin instead, either just for the wakeup pulses or the whole time even for the SPI transfers.

 

 

Regards,

Daniel

 

 

View solution in original post

0 Kudos
3 Replies
1,921 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello JoDo,

You need to create a separate configuration for the second device controlled by the PCS.

danielmartynek_0-1636040069681.png

And then use the generated structure as an argument in the Transmit() function.

danielmartynek_1-1636040176801.png

 

Regards,

Daniel

 

 

0 Kudos
1,911 Views
JoDo
Contributor III

Hello @danielmartynek,

Thanks for the answer. There is no second device, only one connected to a TPL transceiver via SPI-TX (master) and SPI-RX (slave). I need to send a wake-up pattern via the MC33664, this requires pulsing the CS pin of the SPI-TX without sending data via MOSI (see the pictures and code below).

One way is to change the polarity of the CS pin (CS idle low /high) by re-initializing the SPI-TX, but maybe there is a better way to control the CS pin?

Figure: MCU TPL transceiver schematics: 

JoDo_1-1636099666622.png

Figure: MCU sends wake-up pattern via TPL transceiver

JoDo_2-1636099824535.png

 

Code: Wake-up pattern suggested by NXP driver

 

    /*Wake up Pattern */
/* CSB_TX low for 25 us. */
    BCC_MCU_WriteCsbPin(0);
    BCC_MCU_WaitUs(BCC_WAKE_PULSE_US);

    /* CSB_TX high for 600 us. */
    BCC_MCU_WriteCsbPin(1);
    BCC_MCU_WaitUs(BCC_T_WAKE_DELAY_US);

    /* CSB_TX low for 25 us. */
    BCC_MCU_WriteCsbPin(0);
    BCC_MCU_WaitUs(BCC_WAKE_PULSE_US);

 

 

Regards,

JoDo

 

0 Kudos
1,902 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello JoDo,

I see, thank you.

The driver does not allow that.

And even if it allowed that by re-initializing the whole driver, I don't think you would achieve a precise timing because of the SW overhead.

You can modify the registers of LPSPI module directly.

Or you can disable LPSPI PCS and use the GPIO function of the pin instead, either just for the wakeup pulses or the whole time even for the SPI transfers.

 

 

Regards,

Daniel

 

 

0 Kudos