FreeModbus_Slave-Master-RTT-STM32 icon indicating copy to clipboard operation
FreeModbus_Slave-Master-RTT-STM32 copied to clipboard

freemodbus主机代码经过疲劳测试触发定时器断言

Open XieFang2019 opened this issue 11 months ago • 1 comments

freemodbus主机代码经过几小时测试触发定时器断言

(( eSndState == STATE_M_TX_XFWR ) || ( eSndState == STATE_M_TX_IDLE )) has assert failed at xMBMasterRTUTimerExpired.

此断言发生在软定时器回调中

xMBMasterRTUTimerExpired(void){
...
    switch (eSndState)
    {
        /* A frame was send finish and convert delay or respond timeout expired.
         * If the frame is broadcast,The master will idle,and if the frame is not
         * broadcast.Notify the listener process error.*/
    case STATE_M_TX_XFWR:
        if ( xFrameIsBroadcast == FALSE ) {
            vMBMasterSetErrorType(EV_ERROR_RESPOND_TIMEOUT);
            xNeedPoll = xMBMasterPortEventPost(EV_MASTER_ERROR_PROCESS);
        }
        break;
        /* Function called in an illegal state. */
    default:
        CMB_ASSERT(
                ( eSndState == STATE_M_TX_XFWR ) || ( eSndState == STATE_M_TX_IDLE ));
        break;
    }
...
}

接收到软定时器回调时处于 STATE_M_TX_IDLE 状态 此时处理switch (eSndState)就会进入断言 相反这时候应该是STATE_M_TX_XMIT状态才正常

typedef enum
{
    STATE_M_TX_IDLE,              /*!< Transmitter is in idle state. */
    STATE_M_TX_XMIT,              /*!< Transmitter is in transfer state. */
    STATE_M_TX_XFWR,              /*!< Transmitter is in transfer finish and wait receive state. */
} eMBMasterSndState;

XieFang2019 avatar Dec 10 '24 03:12 XieFang2019

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

manceasd avatar Dec 10 '24 03:12 manceasd