Boost logo

Boost Users :

From: Georg Gast (georg_at_[hidden])
Date: 2020-10-16 16:31:06


Dear Boost users,

i am currently writing a driver for the ADS1256 chip with Boost.MSM.
Yes, there are other drivers. I do this for training and fun. During the
startup phase i need to defer the requests from the user as the SPI bus
is not yet available. To model the behaviour the most correct, i tried
to model it with MSM.

In the transition table, i use the "Defer" action to defer these events.
In my Idle state, after the startup phase, there is a transition with
this defered event going to the "work" states. In the debugger i can
see, that the defered_event_queue holds one defered event and it is of
my type but it is not processed.

I did use boost 1.67.0 (from debian buster ) and also 1.74.0 (self
compiled) to test this. My program can be also compiled under Windows
and VS2019 as i handled the hardware interfacing with a abstract class.
It works under Windows and 1.74.0. With VS2017 and 1.67.0 it also does
not work. Under Linux and gcc it always stops at the Idle state where i
wait for the defered event.

At the end is my transition table.

Any ideas are welcome!

Georg

        // clang-format off
        struct transition_table : mpl::vector<
                //
+----------------+-------------------+----------------+---------------------------+----------------------+
                // Region 0
                //
+----------------+-------------------+----------------+---------------------------+----------------------+
                // Start Event Next Action
                  Guard
                //
+----------------+-------------------+----------------+---------------------------+----------------------+
                Row < NotIntialized , ev_Init , WaitDRDYID , none
                , none >,
                Row < WaitDRDYID , ev_CheckFlags , ReadID , none
                , IsDrdy0 >,
                Row < ReadID , ev_CheckFlags , none , none
                , none >,
                Row < ReadID , Spi::Reply , ReadIDFailed , none
                , IsIDNotOk >,
                Row < ReadID , Spi::Reply , Idle , none
                , IsIDOk >,

                // during the startup phase these event must be defered
                Row < NotIntialized , ev_MultiStart , none , Defer
                , none >,
                Row < WaitDRDYID , ev_MultiStart , none , Defer
                , none >,
                Row < ReadID , ev_MultiStart , none , Defer
                , none >,

                //
+----------------+-------------------+----------------+---------------------------+----------------------+
                Row < Idle , ev_CheckFlags , none , none
                , none >,
                Row < Idle , ev_MultiStart , MConfigWaitDRDY, none
                , none >,
                //
+----------------+-------------------+----------------+---------------------------+----------------------+
                Row < MConfigWaitDRDY, ev_CheckFlags , MSwitchConfig , none
                , IsDrdy0 >,
                Row < MSwitchConfig , ev_CheckFlags , none , none
                , none >,
                Row < MSwitchConfig , Spi::Reply , MMuxWaitDRDY , none
                , IsECNotFailed >,

                Row < MMuxWaitDRDY , ev_CheckFlags , MSwitchMux , none
                , IsDrdy0 >,
                Row < MSwitchMux , ev_CheckFlags , none , none
                , none >,
                Row < MSwitchMux , Spi::Reply , MSync , none
                , IsECNotFailed >,

                Row < MSync , Spi::Reply , MDataWaitDRDY , none
                , IsECNotFailed >,
                Row < MDataWaitDRDY , ev_CheckFlags , MReadData , none
                , IsDrdy0 >,
                Row < MReadData , ev_CheckFlags , none , none
                , none >,
                Row < MReadData , Spi::Reply , Idle , WorkDone
                , IsWorkDone >,
                Row < MReadData , Spi::Reply , MMuxWaitDRDY ,
RemoveDoneWork , IsStillWorkTodo >,

                //
+----------------+-------------------+----------------+---------------------------+----------------------+
                // Region 1
                //
+----------------+-------------------+----------------+---------------------------+----------------------+
                Row < DrdyUndefined , ev_DRDY_0 , Drdy0 , none
                , none >,
                Row < DrdyUndefined , ev_DRDY_1 , Drdy1 , none
                , none >,

                Row < Drdy0 , ev_DRDY_0 , none , none
                , none >,
                Row < Drdy0 , ev_DRDY_1 , Drdy1 , none
                , none >,

                Row < Drdy1 , ev_DRDY_0 , Drdy0 , none
                , none >,
                Row < Drdy1 , ev_DRDY_1 , none , none
                , none >,

                //
+----------------+-------------------+----------------+---------------------------+----------------------+
                // Region 2
                //
+----------------+-------------------+----------------+---------------------------+----------------------+
                // Start Event Next Action
                  Guard
                //
+----------------+-------------------+----------------+---------------------------+----------------------+
                Row < AllOk , Spi::Reply , ErrorMode , none
                , IsECFailed >
                //
+----------------+-------------------+----------------+---------------------------+----------------------+
> {};
        // clang-format on


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net