Since updating to float package 2.0, on my Focer 3.1, I’ve gotten weird issues with my headlights that are run by an arduino. The arduino is using the vescUart library, and will run the headlights normally for a few seconds before freezing. If I go to “app config” and change “app to use” to None, then change it back to UART, it sometimes fixes the issue, but power cycling the board causes the arduino to freeze again. (Normally the headlights will react to motor rpm)
I’m not sure changing app config actually does anything since “enable permanent UART” must be set to true. I learned that the hard way after loosing Bluetooth access.
This issue popped up after I installed the new float package, so I’m curious if there’s a way to downgrade to 1.3 to test if it’s truly a bug vs a poorly timed arduino issue.
That might be because the new LED code is quite impolitely and unconditionally deinitializing the timer/DMA used for the LEDS on the new VESCs, without a consideration those might be used for something else on other hardware.
Oh, and I just realized, you don’t have the previous version of the package to downgrade to, right? I expected to find it among releases on @surfdado’s github repo, but there are none.
I wanted to attach a package for you, but the forum doesn’t allow it. @surfdado should be able to sort you out eventually…
Thanks for the reply! The timer issue makes a lot of sense. Would you have any idea how to resolve that with code on the arduino side?
Also, I did a bit more digging and have some more accurate more details:
-If I start up my vesc with app config as “No App” and then switch it to “UART” after it has powered on, the arduino reacts normally.
-On the other hand, if I power the board on with UART enabled from the start, after a short while, it causes my arduino to flash the “MBed OS crashed” sequence (4 short and then 4 long blinks of the red LED). This always seems to happen right when the motor engages, so my first guess was that electrical interference is corrupting the first few data packets on startup.
Hopefully this extra info is helpful! I’ll try to see if I can get a crash report from the arduino eventually, but right now it’s buried in my board haha.
Oh and you are correct, I don’t have the previous package. I’ve also tried to find the older float package on GitHub, but was unsuccessful.
The bug is in Float package 2.0. It matches exactly with what you describe. When Float loads up (pretty much exactly at the time the motor engages), it deinitializes the timer and DMA as part of the LEDs initialization sequence (this is wrong, it can’t be done that way, especially when you don’t even have the LEDs enabled in the first place). At that time, the UART stops working for your Arduino (looks like it’s not handled gracefully on Arduino side if you get the crash).
If, after Float started, you change the configuration of the UART, VESC will re-initialize it properly and it’ll start working (until you restart Float…).
It’s basically 1.3 with some minor fixes and AFAIK one bug introduced: Flywheel doesn’t turn off by pressing sensors when it’s not running (this one is on me ). So just don’t use Flywheel or be aware.
But, I expect it’ll get fixed in Float pretty quick once the guys notice the mentions…
Can you double-check? I’ve had a look at the fix and it should definitely do the job. And I can’t think of anything else in there could cause this… Maybe you forgot to refresh the package archive or something?
Erm… I abstain from judging Did you write the code? I’d say you can try to debug it, have a look at how it interacts with the VESC etc.
But that’s probably going to be hard and if it has worked before, it should work now as well. If you’re able, you can try to compile the Float package, that’s not too hard if you can program an Arduino, you just need GCC ARM compiler, make and vesc_tool (on Linux or WSL for Windows).
If you manage to compile it, you can try to hack the code - comment out the LED functions or bisect git history to see what commit broke your use case.
Yep, I wrote a good chunk of the code myself, aside from some of the wifi parts.
Thanks for the info on how to compile float package! I’ve been meaning to ask how to do that and it’ll be cool to play around with editing/adding functions.
I’ll try to set aside some time for seeing what makes my arduino unhappy. Will report back if I identify it
So I switched to an arduino nano esp, and the problem doesn’t seem to exist on that board, instead of freezing when float initializes, it reboots and works properly, so freezing is something specific to the RP2040 but I haven’t had time to look into exactly why that is.
In either case the problem is resolved on my end.
Unrelated, I got OTA updates working on the ESP version too!