How to: MSDI MC33CD1030 on S32K396BMS-EVB using NXP MBDT

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

How to: MSDI MC33CD1030 on S32K396BMS-EVB using NXP MBDT

How to: MSDI MC33CD1030 on S32K396BMS-EVB using NXP MBDT

Introduction


The following article shows a basic configuration and model for S32K396BMS-EVB that configures the SPI to communicate with the MC33CD1030 MSDI IC mounted on the evaluation board.

 

Prerequisite software


The following software tools were used to develop and deploy the application onto the S32K396BMS-EVB board.


 

Prerequisite hardware


The application is developed for the following hardware*:

  • S32K396BMS-EVB
  • Debug probe (used to deploy the example and to connect the FreeMASTER application to the board)
  • 12V power supply
     

Configuration project


In this chapter, I show most important settings that must be to allow the MCU to enter standby mode and to be able to wake up and switch to RUN mode again. For more details, please download the files attached and consult the configuration project.

 

Pins configuration
 

For the CD1030, only the SPI pins must be configured;

  • LPSPI3 PCS1: PTF18 (OUTPUT)
  • LPSPI3 CLOCK: PTF13 (OUTPUT)
  • LPSPI3 SIN: PTF12 (INPUT)
  • LPSPI3 SOUT: PTF15 (OUTPUT)
     
SorinIBancila_0-1777471509980.png

Figure 1. Configuration Pins tab - LPSPI pins

 
Peripherals configuration

Platform component


The interrupt must be configured for the LPSPi3. To configure it, please go to PLATFORM -> Interrupt Controller and add a new entry into the table, as below.

SorinIBancila_1-1777471606813.png

Figure 2. Configuration Platform Component - Enable LPSPI3 interrupt

 

MCU Component


The peripheral clock must be enabled and it can be done from the MCU component -> McuModuleConfiguration -> McuModeSettingsConf.

SorinIBancila_2-1777471646182.png

Figure 3. Configuration MCU Component - Enable LPSPI3 peripheral clock

 

SPI Component


The MCU communicates with MC33CD1030 over the LPSPI3. First step is to configure the Spi -> SpiGeneral -> SpiPhyUnit

SorinIBancila_3-1777471737967.png

Figure 4. Configuration SPI Component - SpiPhyUnit (LPSPI3)

 

Then, the Spi->SpiDriver must be configured.

Important! The frame size of the SPI messages: It must be 32-bit wide and MSB.

SorinIBancila_4-1777471790174.png

Figure 5. Configuration SPI Component - SpiChannel

 

SorinIBancila_5-1777471818464.png

Figure 6. Configuration SPI Component - SpiExternalDevice

 

SorinIBancila_6-1777471857095.png

Figure 7. Configuration SPI Component - SpiJob

 

SorinIBancila_7-1777471913175.png

Figure 8. Configuration SPI Component - SpiSequence

 

Model configuraiton

The Simulink model used to communicate with the MC33CD1030 can be seend in the picture below. It can also be found in the achieve attached to this article.

The initialization of the model sets the AsyncMode to interrupt.

SorinIBancila_1-1777472543316.png

Figure 9. Simulink Model - Initialization subsystem

 

The application executes the following tasks at each step:

  • Set up the External Buffer for the LPSPI3 SpiChannel_CD1030. The input for the block must be an array of 4 uint8 elements (in total 4 bytes - 32bit). The control word is the last element, while the first 3 elements are the configure words. The Dest Data output is a data story memory configured as uint8 with the size equal to 4.
  •  Send the command to the MC33CD1030 IC and receive the previous result in CD1030_RecvData_SG data store
  • Increment a variable to check that the application is running
SorinIBancila_0-1777473333102.png

 

Figure 10. Simulink Model - Full Overview

 

Validation

To validate the application, the FreeMASTER tool is used to connect to the board and initiate the sequence to enter standby mode. To connect the board, you can use the LPUART1 (J6 connector), baud rate 115200.

If everything is properly configured, in the FreeMASTER you should see the following in the Variable Watch:

  • The SPI_SetAsyncMode_Status, CD1030_SetupEB_Status and SPI_Transmit_Status should all be 0.
  • The CD1030_RecvData_SG (BIN) and CD1030_RecvData_SG (HEX) should display the content of the CD1030's register 0x3E Read switch status registers SG.
  • The step_counter should increment at each step execution.
SorinIBancila_1-1777473443463.png

Figure 11. FreeMASTER Project - Variable Watch

 

To test that the CD1030 is working, I connect the J10_6 (SG0 - KEY_ON_DIN) to either GND or VCC and we can see that the last bit of the register changes.

SorinIBancila_2-1777473882992.png

 Figure 12. FreeMASTER Project - J10_6 connected to GND

SorinIBancila_3-1777473915113.png

 Figure 13. FreeMASTER Project - J10_6 connected to VCC

 

Conclusion

 

In this article, I presented a basic implementation that allows the S32K396 communicate with the MC33CD1030 IC over the SPI. For further details, please consult the MC33CD1030 reference manual.

Labels (1)
Attachments
100% helpful (1/1)
Version history
Last update:
3 weeks ago
Updated by: