#include "MK50D10.h"
Calling
uint32_t error = RCM_GetPreviousResetSources(RCM); // Causing hard fault every time
I also updated the driver to be like the MK64 versions which does two unit8_t reads and it still crashes (like this)
static inline uint32_t RCM_GetPreviousResetSources(RCM_Type *base)
{
#if (defined(FSL_FEATURE_RCM_REG_WIDTH) && (FSL_FEATURE_RCM_REG_WIDTH == 32))
return base->SRS;
#else
uint8_t tmpSrs0 = base->SRS0;
uint8_t tmpSrs1 = base->SRS1;
return (uint32_t)((uint32_t)tmpSrs0 | ((uint32_t)tmpSrs1 << 8U));
// return (uint32_t)((uint32_t)base->SRS0 | ((uint32_t)base->SRS1 << 8U));
#endif /* (FSL_FEATURE_RCM_REG_WIDTH == 32) */
Any idea why the MK50 crashes when you call this? I use it everywhere on other projects and have never seen / had a problem except for this.
The exact fault is
BFARVALID (7) BusFault address register (BFAR) valid flag
PRECISERR (1) Precise data bus error
If that helps diagnose the issue...
Here is an image showing RCM is there, working, you can inspect it, and the fault after you run it
