Mesa modbus and pktUart

  • vre
  • Away
  • Platinum Member
  • Platinum Member
More
14 Mar 2025 00:50 - 14 Mar 2025 00:54 #323880 by vre
Replied by vre on topic Mesa modbus and pktUart
Seems to be related also to this
forum.linuxcnc.org/27-driver-boards/5432...v2d-firmware?start=0

If after startup set update-hz to 0.0001 or something non zero problem seem to stops..
Is this division by zero bug?

#define MAX_MSG_LEN 16 // may be increased if necessary to max 251
#define DEBUG 2
static const hm2_modbus_chan_descriptor_t channels = {
/* {TYPE, FUNC, ADDR, COUNT, pin_name} */
{HAL_BIT, 2, 0x0000, 32, "in"},
{HAL_BIT, 15, 0x0000, 32, "out"},
// {HAL_U32, 6, 0x00FE, 1, "setbaud"},
// {HAL_U32, 3, 0x00FE, 1, "baud"},
};


 
Last edit: 14 Mar 2025 00:54 by vre.

Please Log in or Create an account to join the conversation.

More
14 Mar 2025 00:55 #323882 by PCW
Replied by PCW on topic Mesa modbus and pktUart
Yes, this is a long known bug, never set the update rate to 0.

Please Log in or Create an account to join the conversation.

  • vre
  • Away
  • Platinum Member
  • Platinum Member
More
14 Mar 2025 00:57 - 14 Mar 2025 09:59 #323883 by vre
Replied by vre on topic Mesa modbus and pktUart
This is the reason for crazy data readings on encoders ?
I make now a config that encoder.count and encoder.velocity goes crazy to see if it stops by setting update-hz to non zero

Yes problem of noise in encoders resolves by non zero value to update-hz
verified by different configs that produced random data to different encoders.
All random data stop to encoders if update-hz is non zero but stop and modbus device to work.
 
Last edit: 14 Mar 2025 09:59 by vre.

Please Log in or Create an account to join the conversation.

  • vre
  • Away
  • Platinum Member
  • Platinum Member
More
14 Mar 2025 09:58 #323901 by vre
Replied by vre on topic Mesa modbus and pktUart
If i set non zero update-hz problem of crazy data reading on encoders stop
but also stops working modbus device so no solution here..

Please Log in or Create an account to join the conversation.

More
14 Mar 2025 14:23 #323927 by PCW
Replied by PCW on topic Mesa modbus and pktUart
If you ever set the update rate to 0, you can never change it again or the driver will hang (this is a known bug)

Please Log in or Create an account to join the conversation.

  • vre
  • Away
  • Platinum Member
  • Platinum Member
More
14 Mar 2025 16:20 - 14 Mar 2025 16:25 #323934 by vre
Replied by vre on topic Mesa modbus and pktUart
I start with 0.1 in hal file setting and does not work
if change it to 0 from halshow starts working but encoder reads crazy data.
Also if change functions order in vhdl pin file changes affected encoder number and pins.
Seems to be bug in vhdl because the functions order affects the encoder that is affected
in one config affected encoder.00.input-a and b
and in other config encoder.04.velocity and count.
Also when modbus device working the encoder reads crazy data when not working
by removing power supply/unwiring or stop it by setting update-hz to non zero
the same time stops the problem to encoder.
Seems like electric noise problem internaly in fpga
The same module works ok with mb2hal so it is not the module
Last edit: 14 Mar 2025 16:25 by vre.

Please Log in or Create an account to join the conversation.

More
14 Mar 2025 16:39 - 14 Mar 2025 16:42 #323935 by PCW
Replied by PCW on topic Mesa modbus and pktUart
The error when setting the update rate to 0 is that you cannot change it
after this has been done:

   "If you ever set the update rate to 0 (maximum), changing to a
    non-zero rate will not work (communication stops)"

I have no issue with the ioc32 running at 9600 baud at a .1 second update rate.

 The bug is in either Mesa modbus or the PKTUART driver, not the VHDL.
Most likely the drivers idea of the amount of read data does not match
the actual amount returned, so data from one module is mixed with the
previous or subsequent modules data.

It could also conceivably be a memory/stack issue in the modbus or PKTUART driver.

 
Last edit: 14 Mar 2025 16:42 by PCW.

Please Log in or Create an account to join the conversation.

  • vre
  • Away
  • Platinum Member
  • Platinum Member
More
14 Mar 2025 16:43 - 14 Mar 2025 16:52 #323936 by vre
Replied by vre on topic Mesa modbus and pktUart
I have start with 0.1 setting and does not work.
Reads only the inputs at startup but can not set outputs neither led in ioc32 blinks.
I was thinking the works but because saw input pin lighting in halshow but when try
to set out pin not works neither
data transfer modbus led blinking in ioc32
Last edit: 14 Mar 2025 16:52 by vre.

Please Log in or Create an account to join the conversation.

More
14 Mar 2025 17:10 #323937 by PCW
Replied by PCW on topic Mesa modbus and pktUart
Are you saying you have the update rate set to 0 in the hal file?

(and 0 is bad as it triggers the divide by 0 bug)

I don't see an issue with .1 second update rate
(I have used that value but probably set it later)

It looks like much of this may be related to the divide by 0 bug in the driver


 

Please Log in or Create an account to join the conversation.

  • vre
  • Away
  • Platinum Member
  • Platinum Member
More
14 Mar 2025 17:33 - 14 Mar 2025 17:38 #323938 by vre
Replied by vre on topic Mesa modbus and pktUart
No it is not divide by 0 bug.I have tested that fix in mesa_modbus.c.tmpl code but problem not fixed.I have set update-hz 0.1 in hal file and does not work.
Only 0 works but if modbus is working encoder reads crazy data.
Encoder stop read crazy data only if modbus
does not work.
Can't work both encoder and modbus.
But the problem appears when there are 5 encoders not only 4
Last edit: 14 Mar 2025 17:38 by vre.

Please Log in or Create an account to join the conversation.

Time to create page: 0.098 seconds
Powered by Kunena Forum