Putting SBC to sleep?

cancel
Showing results for 
Search instead for 
Did you mean: 

Putting SBC to sleep?

Jump to solution
542 Views
gearhead1107
Contributor IV

I'm trying to work on a low power mode for my project based off the S32 FRDM board (S32K144 and MC33905D SBC), and I'm having issues putting the SBC to sleep.

 

Based on the available drivers, I'm attempting to do this by

  • Create an sbc_can_config_t struct that sets the mode to "SBC_CAN_MODE_SLEEP_WITH_WAKEUP" over SBC_SetCanMode();
  • Checking to see if a wakeup message has occurred on the bus by periodically sending SBC_GetWakeupReason(); and checking the response

Is this approach valid?

 

Currently the LPSPI seems to send the message when setting the CAN mode, but time out and get caught in an interrupt. I'm still looking into the issue, but my knee-jerk assumption is that the SBC is going into a sleep mode and not acknowledging the SPI communication. Does this sound logical?

 

 

I'm pretty new to both components, and really hoping someone can point me in the right direction here.

Labels (1)
0 Kudos
1 Solution
225 Views
gearhead1107
Contributor IV
Found the issue! During my initialization of the SBC, I wasn't aware that the structure lpspi_master_state_t was going to be used as a global pointer. Once I realized that the global state pointer was set to that structure's location on initialization my error became pretty apparent. Moving it out of my init function and making it static kept the location from moving around during execution!

View solution in original post

0 Kudos
2 Replies
226 Views
gearhead1107
Contributor IV
Found the issue! During my initialization of the SBC, I wasn't aware that the structure lpspi_master_state_t was going to be used as a global pointer. Once I realized that the global state pointer was set to that structure's location on initialization my error became pretty apparent. Moving it out of my init function and making it static kept the location from moving around during execution!

View solution in original post

0 Kudos
225 Views
gearhead1107
Contributor IV

Still working on this issue. As far as I can tell, the SBC driver attempts to send the CAN config to the SBC by doing the following:

  • Sending the command using LPSPI_DRV_MasterTransferBlocking();
  • LPSPI_DRV_MasterTransferBlocking(); calls on LPSPI_DRV_MasterStartTransfer(); to send the actual data, and then waits for LPSPItimeout to run down or for the BUSY flag to go away in hardware
  • Inside StartTransfer();, the variable lpspiState->bytesPerFrame is used to determine how many bytes will be sent. The only problem is that it doesn't look like this parameter is ever being initialized? The configured frame size is 536899396 (or whatever happens to be in memory when the program is run)
0 Kudos