CAN Unit on M5Tough
I cannot get the CAN unit working on my M5Tough. The same setup with a M5Fire works fine.
First the setup with the Fire:
I connected the unit to port B with the resistor between L and H. This is connected to a mini PLC, where I knew CAN was definitely working (also with the resistor installed).
I can now send messages between the Fire and the PLC.
When I switch out the Fire for the Tough it doesn't work anymore. I cannot receive or send messages.
I'm using the same code on both M5 products except I switched out "M5Stack.h" for "M5Tough.h". (I also tried with "M5Stack.h" on the Tough)
Also tried using the latest version from github (2021/11/01) - no success
I bought 10 M5Tough to use as HID for small PLCs and now I cannot use them.
I'm out of ideas. Can anyone help?
Also: Is there a working example for CAN on UIFlow somewhere out there? This would make updating the code and other things much easier.
felmue last edited by
not sure if it helps, but there is a CAN example for the M5Tough - maybe give it a try?
The CAN example for the M5Tough doesnt't compile because it refers to buttonA and buttonB. So I guess this was just copied from the M5Fire example... Even if I comment out these parts, so that it can only receive CAN messages and it compiles, it doesn't work.
My guess is, that something is different in the hardware of the M5Tough compared to the fire and that the libraries are not completely updatet yet...
felmue last edited by felmue
sorry about that. Yes, for some reason the touch buttons have been eliminated (compared to M5Core2) although I have no idea why.
I am afraid you are correct that the M5Tough examples have been rushed (wouldn't be the first time) and have been poorly tested if at all.
From what I can tell M5Tough hardware is mostly based on M5Core2 which is quite different from M5Stack (Fire, Base, Gray).
That said, I fail to see why the CAN unit shouldn't work - it's just using the two GPIOs from port B.
Since I don't have an M5Tough nor the CAN unit I cannot try it myself and at this point I am out of ideas, sorry.
felmue last edited by felmue
I just found the CAN unit UIFlow example. Check out
CAN. Again, I have no idea as to why the CAN unit is handled differently and not part of the regular units list.
Examples can be found here.
Please be aware that the UIFlow example is set to use port C, but is using the incorrect GPIOs even when selecting M5Tough. It should be GPIO14 for TX and GPIO13 for RX (and not GPIO17 and GPIO16, which would be ok for M5Stack).
Thank you for your time. I will investigate the CAN issue further and if I can get it to work on the M5Tough, I will have to use the Fire for now although I will have to make a watertight enclosure because this goes onto a tractor.
A big Thank You for the uiflow example. I looked at the documentation but couldn't find it....
If I get this to work, uiflow would make it so much easier to update the code in the field