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.
The following software tools were used to develop and deploy the application onto the S32K396BMS-EVB board.
The application is developed for the following hardware*:
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.
For the CD1030, only the SPI pins must be configured;
Figure 1. Configuration Pins tab - LPSPI pins
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.
Figure 2. Configuration Platform Component - Enable LPSPI3 interrupt
The peripheral clock must be enabled and it can be done from the MCU component -> McuModuleConfiguration -> McuModeSettingsConf.
Figure 3. Configuration MCU Component - Enable LPSPI3 peripheral clock
The MCU communicates with MC33CD1030 over the LPSPI3. First step is to configure the Spi -> SpiGeneral -> SpiPhyUnit
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.
Figure 5. Configuration SPI Component - SpiChannel
Figure 6. Configuration SPI Component - SpiExternalDevice
Figure 7. Configuration SPI Component - SpiJob
Figure 8. Configuration SPI Component - SpiSequence
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.
Figure 9. Simulink Model - Initialization subsystem
The application executes the following tasks at each step:
Figure 10. Simulink Model - Full Overview
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:
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.
Figure 12. FreeMASTER Project - J10_6 connected to GND
Figure 13. FreeMASTER Project - J10_6 connected to VCC
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.