Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
XieFang2019 opened this issue Dec 10, 2024 · 1 comment
Open

Comments

@XieFang2019
Copy link

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;
@manceasd
Copy link

manceasd commented Dec 10, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants