Page 1 of 1

Bug causing SysHalt, interpret error?

Posted: Wed Jun 25, 2014 9:15 am
by Korken
Hi,

I have a bug I'm trying to track down and when the system stops I get the reason = 0x800bca0 <__func__.6453> "chEvtSignalI".
Is it correct to assume that the cause of this error has to do with the call to a chEvtSignalI somewhere?

If so, I have two chEvtSignalI in my code but it is correctly bounded as:

Code: Select all

/**
 * @brief MPU6050 external interrupt callback.
 *
 * @param[in] extp      Pointer to EXT Driver.
 * @param[in] channel   EXT Channel whom fired the interrupt.
 */
void MPU6050cb(EXTDriver *extp, expchannel_t channel)
{
    (void)extp;
    (void)channel;

    if (thread_sensor_read_p != NULL)
    {
        /* Wakes up the sensor read thread */
        chSysLockFromISR();
        chEvtSignalI(thread_sensor_read_p, ACCGYRO_DATA_AVAILABLE_EVENTMASK);
        chSysUnlockFromISR();
    }
}

/**
 * @brief HMC5983 external interrupt callback.
 *
 * @param[in] extp      Pointer to EXT Driver.
 * @param[in] channel   EXT Channel whom fired the interrupt.
 */
void HMC5983cb(EXTDriver *extp, expchannel_t channel)
{
    (void)extp;
    (void)channel;

    if (thread_sensor_read_p != NULL)
    {
        /* Wakes up the sensor read thread */
        chSysLockFromISR();
        chEvtSignalI(thread_sensor_read_p, MAG_DATA_AVAILABLE_EVENTMASK);
        chSysUnlockFromISR();
    }
}


This is where I don't quite know what to look for any more.
But for starters, have I interpreted the reason correctly?
Any pointer as to what I should be looking for?

Thanks in advance!

Re: Bug causing SysHalt, interpret error?

Posted: Wed Jun 25, 2014 9:27 am
by Giovanni
Could you trace which assert or check is triggered inside chEvtSignalI() ?

Giovanni

Re: Bug causing SysHalt, interpret error?

Posted: Wed Jun 25, 2014 10:33 am
by Korken
The OS has yet again made me look stupid :lol:
When I checked the asserts as you requested the event source pointer had been corrupted, which was tracked down to an error in the code saving settings (which are located just before the event source in memory).
This caused the event source to be overwritten with "junk" data causing the error.

I'm impressed that the OS caught that! Very good!

Thanks for the tip to look at the assert and check inside the chEvtSignalI(), Giovanni!
I will keep that in my bag of tricks for the next time. :)