Announcement

REXYGEN forum has been moved. This one is closed.
Head over to the new REXYGEN Community Forum at https://forum.rexygen.com.

Looking forward to meeting you there!
 

#1 2016-11-14 18:43:26

farcouet@yahoo.es
Member
Registered: 2016-10-11
Posts: 6

Error handling within the Piface driver

Hi,

I have seen sometime a problem (probably due to not perfect powersupply filtering) were the IO from the MCP23S17 are not matching what is in the RexDraw monitoring. Even changing a IO state will not trigger a refresh of the outputs on the MCP23S17. So they will stay in the state they are and the only way to change them is to restart the RPI or re-download from RexDraw.

I hooked the logic analyzer to it and I can see that Rex reads the register from the MCP23S17 before every write. If it's not matching it seems that it's not doing anything to correct it (I would expect Rexcore to see that the output register is invalid and force it to the proper status). Not happening often and I think I fixed it by filtering a bit better the power.

But is it a normal behavior? Could it be possible to modify the driver so it will ensure that the output is always correct (specially that it detects the problem by reading it)? Even I would reconfigure the MCP23S17 if there is a mismatch (so perform the initialization sequence like the one is performed when the Rex is started).

I know I could use the Rexlang to recode this but it would be great if it was handled in the driver.

Thanks!
Fred

Last edited by farcouet@yahoo.es (2016-11-14 18:44:14)

Offline

#2 2016-11-25 14:11:33

tomáš čechura
Administrator
Registered: 2016-02-22
Posts: 371

Re: Error handling within the Piface driver

Hi Fred,

Piface driver doesn't expect the outputs to be changed externally (i.e. by external script, powersupply failure, ...).
The driver writes the outputs only when they are changed in REX Control System. For example if you change one bit, REX will read whole byte, change the only bit you changed and send the byte back to Piface. It doesn't performe any error checking.

To ensure that the desired values from REX will be forced into Piface even after some errors caused by powersupply you can use following workaround. Use only multi-flag (all the input and output flags for the PiFace Digital expansion board are prepared
by default in the folder C:\Program Files (x86)\REX Controls\REX <version>\Examples\PiFaceDigital_examples\00_IO_Flags). Connect function block BIS to any of unused output pins and set the switching period corresponding to the period of the task.
The "blinking" bit will force the Piface driver to write in every period.

I will pass your proposal to our developers.

Regards, Tomas

Offline

Board footer

Powered by FluxBB