We are currently using Kinetis MK10DX256VLK7 Microcontrollers which runs MQX v4.0.1 on a couple of board types (primarily to manage IOs) which differ mostly in their configurations (Number of DI/DO etc) and we have recently stumbled on an issue which happens only on one of our board types after around 2-3 days of continues running with continual IO operation and communication through CANbus.
In our CAN communication task we sleep on an event which is triggered upon CAN frame send completion and inside the MQX function _lwevent_wait_for we get a fault due to wrong memory address access, register R7 which is used to access the stack points to the wrong location (the low word of the register has been zeroed out). The strange thing is that inside _lwevent_wait_for before the call to _lwevent_wait_for_internall the value of the register is ok.
Does anyone have an Idea what is happening? Could this be an issue with rescheduling which happens inside _lwevent_wait_for_internall? Could this be an issue with interrupts? Could this be our fault somehow but only happens once every couple of days and only on one board layout?