Hello,
From time to time I noticed, that MQX blocks in the following loop:
static uint_32 _esdhc_status_wait
(
/* [IN] Module registry pointer */
SDHC_MemMapPtr esdhc_ptr,
/* [IN] Mask of IRQSTAT bits to wait for */
uint_32 mask
)
{
uint_32 result;
do
{
result = esdhc_ptr->IRQSTAT & mask;
}
while (0 == result);
Because IQRSTAT == 0 and mask == 2. The problem is, tha all tasks are stopped and no external diagnostic is possible if this comes up.
Is it a SD card or a MQX issue? Any ideas?
Hi F. Bilz,
Did you test the sdcard example? This is located at the path: Freescale_MQX_4_1/mfs/examples/
Regards
Sol
We have activated the HW watchdog as work around. Here's the code snipped:
void init_hw_wdt ( void )
{
_int_disable();
// Write sequence within 20 clock cycles to unlock register
WDOG_UNLOCK = 0xC520;
WDOG_UNLOCK = 0xD928;
WDOG_TOVALH = 1000; // about 7 seconds
WDOG_STCTRLH |= WDOG_STCTRLH_WDOGEN_MASK;
WDOG_REFRESH = 0xA602;
WDOG_REFRESH = 0xB480;
_int_enable();
}
void hw_wdt_reset ( void )
{
_int_disable();
WDOG_REFRESH = 0xA602;
WDOG_REFRESH = 0xB480;
_int_enable();
}
@freescale: Could you integrate controller specific code for the hardware watchdog into future MQX releases?
Not sure what processor you are on but you will likely find there is a Processor Expert driver for the watchdog that integrates with MQX. On a K60 we are using the Processor Expert WatchDog_LDD driver for the EWM peripheral.
I too have seen it hang on that line when there is a hardware error on the bus (we suspect an EMI-caused glitch). If you look carefully at the eSDHC code you will be horrified at the number of such infinite loops with no timeout or other error recovery mechanism.