iq-motion-control / iq-control-center

Source code for the IQ Control Center app
GNU Lesser General Public License v3.0
13 stars 0 forks source link

Can't Flash Firmware to Motor #13

Closed bmelanman closed 6 months ago

bmelanman commented 6 months ago

Hello! I'm trying to us IQ Control Center (IQCC) to flash a 40-06 module with its newest position firmware (available here), however I keep getting an error before the flashing can begin.

Upon reconnecting after entering bootmode, IQCC gives the error CheckForAck: Not ACK - and the UART interface becomes disconnected. If I try to reconnect to the motor, IQCC thinks the motor is in recovery mode (presumably because it is still in bootmode), but attempting to use the recovery option results in the same error, and power cycling the motor allows me to repeat this cycle again.

I wouldn't think my UART interface is the issue as I've used it to successfully flash a few 23-06 modules about a month ago or so, so I'm not really sure what else I could try on my end.

Here's the logs (the firmware path was modified before posting):

Sun Apr 14 17:26:07 2024: IQ Control Center Opened with version 1.5.2
Sun Apr 14 17:26:23 2024: Successfully opened serial port: tty.usbmodemflip_Acerakgr1

Sun Apr 14 17:26:23 2024: Detecting modules on the bus

Sun Apr 14 17:26:25 2024: Discovered 1 module IDs
Sun Apr 14 17:26:25 2024: Found module with Module ID: 1

Sun Apr 14 17:26:25 2024: module connected with module id: 1 on tty.usbmodemflip_Acerakgr1 at 115200 baud

Sun Apr 14 17:26:25 2024: Module variables follow:
Sun Apr 14 17:26:25 2024: UID1: 3866673 UID2: 1415009040 UID3: 540029489
Sun Apr 14 17:26:25 2024: module connected has build version: 0.0.0
Sun Apr 14 17:26:25 2024: Generated link for this motor as: http://id.vertiq.co/3866673_1415009040_540029489
Sun Apr 14 17:26:25 2024: connected module has hardware type: 34
Sun Apr 14 17:26:25 2024: connected module has hardware major version: 1
Sun Apr 14 17:26:25 2024: connected module has electronics type: 20
Sun Apr 14 17:26:25 2024: connected module has electronics major version: 0
Sun Apr 14 17:26:25 2024: module connected has bootloader version: 0.0.0.1
Sun Apr 14 17:26:25 2024: module connected has upgrade version: 1.0.1.1
Sun Apr 14 17:26:25 2024: module connected has firmware style: vertiq_40xx_speed
Sun Apr 14 17:26:25 2024: module connected has hardware style: Vertiq 4006 370kv (Gen 2)

Sun Apr 14 17:26:25 2024: Always Armed value index gotten as: 1
Sun Apr 14 17:26:25 2024: Amps Bias value gotten as: -174.49
Sun Apr 14 17:26:25 2024: Arming State value index gotten as: 0
Sun Apr 14 17:26:25 2024: Current Max value gotten as: 50
Sun Apr 14 17:26:25 2024: DroneCAN Bitrate value index gotten as: 1
Sun Apr 14 17:26:25 2024: DroneCAN Bypass Arming value index gotten as: 0
Sun Apr 14 17:26:25 2024: Hobby Calibrated Communication Protocol value index gotten as: 0
Sun Apr 14 17:26:25 2024: Hobby Calibration High value gotten as: 0
Sun Apr 14 17:26:25 2024: Hobby Calibration Low value gotten as: 0
Sun Apr 14 17:26:25 2024: Manual Arming Throttle Source value index gotten as: 0
Sun Apr 14 17:26:25 2024: Maximum Angular Velocity value gotten as: 9999.64
Sun Apr 14 17:26:25 2024: Module ID value gotten as: 1
Sun Apr 14 17:26:25 2024: Power Filter Cutoff value gotten as: 200
Sun Apr 14 17:26:25 2024: Revert to Factory Default Key 1 value gotten as: 0
Sun Apr 14 17:26:25 2024: Revert to Factory Default Key 2 value gotten as: 0
Sun Apr 14 17:26:25 2024: Speed Redline End value gotten as: 1000
Sun Apr 14 17:26:25 2024: Speed Redline Start value gotten as: 960
Sun Apr 14 17:26:25 2024: Stopped Speed value gotten as: 5
Sun Apr 14 17:26:25 2024: Stopped Time value gotten as: 1
Sun Apr 14 17:26:25 2024: Stow Target Acceleration value gotten as: 50
Sun Apr 14 17:26:25 2024: Temperature Filter Cutoff value gotten as: 10
Sun Apr 14 17:26:25 2024: Timeout Meaning value index gotten as: 0
Sun Apr 14 17:26:25 2024: UART Baud Rate value index gotten as: 1
Sun Apr 14 17:26:25 2024: Volts Limit value gotten as: 27
Sun Apr 14 17:26:25 2024: Volume Max value gotten as: 0.799988
Sun Apr 14 17:26:25 2024: Zero Spin Throttle Percentage value gotten as: 0
Sun Apr 14 17:26:25 2024: Zero Spin Throttle Tolerance value gotten as: 0
Sun Apr 14 17:26:25 2024: Arm On Throttle value index gotten as: 1
Sun Apr 14 17:26:25 2024: Arm Throttle Lower Limit value gotten as: 0
Sun Apr 14 17:26:25 2024: Arm Throttle Upper Limit value gotten as: 0.075
Sun Apr 14 17:26:25 2024: Communication value index gotten as: 0
Sun Apr 14 17:26:25 2024: Consecutive Arming Throttles to Arm value gotten as: 1
Sun Apr 14 17:26:25 2024: Disarm Behavior value index gotten as: 0
Sun Apr 14 17:26:25 2024: Disarm On Throttle value index gotten as: 0
Sun Apr 14 17:26:25 2024: Disarm Song Playback Option value index gotten as: 1
Sun Apr 14 17:26:25 2024: Disarm Throttle Lower Limit value gotten as: 0
Sun Apr 14 17:26:25 2024: Disarm Throttle Upper Limit value gotten as: 0
Sun Apr 14 17:26:25 2024: DroneCAN ESC Index value gotten as: 0
Sun Apr 14 17:26:25 2024: DroneCAN Node ID value gotten as: 99
Sun Apr 14 17:26:25 2024: DroneCAN Telemetry Frequency value gotten as: 1
Sun Apr 14 17:26:25 2024: FC 2D/3D Mode value index gotten as: 0
Sun Apr 14 17:26:25 2024: Hold Stow value index gotten as: 0
Sun Apr 14 17:26:25 2024: Mode value index gotten as: 0
Sun Apr 14 17:26:25 2024: Motor Direction value index gotten as: 0
Sun Apr 14 17:26:25 2024: Safe Factor value gotten as: 1
Sun Apr 14 17:26:25 2024: Stow Target Angle value gotten as: 0
Sun Apr 14 17:26:25 2024: Stow Zero Angle value gotten as: 0
Sun Apr 14 17:26:25 2024: Timeout Behavior value index gotten as: 0
Sun Apr 14 17:26:25 2024: Timeout Song Playback Option value index gotten as: 2
Sun Apr 14 17:26:25 2024: CAN Bus Error Passive Flag value gotten as: 1
Sun Apr 14 17:26:25 2024: CAN Bus Error Warning Flag value gotten as: 1
Sun Apr 14 17:26:25 2024: CAN Bus Off value gotten as: 0
Sun Apr 14 17:26:25 2024: CAN Last Error Code value gotten as: 1
Sun Apr 14 17:26:25 2024: CAN Receive Error Counter value gotten as: 255
Sun Apr 14 17:26:25 2024: CAN Transmit Error Counter value gotten as: 0
Sun Apr 14 17:26:25 2024: Convection Thermal Conductivity Coefficient value gotten as: 0.02
Sun Apr 14 17:26:25 2024: DroneCAN Zero Behavior value index gotten as: 2
Sun Apr 14 17:26:25 2024: Input Filter Cutoff value gotten as: 250
Sun Apr 14 17:26:25 2024: Max Velocity value gotten as: 6.3
Sun Apr 14 17:26:25 2024: Max Volts value gotten as: 25.2
Sun Apr 14 17:26:25 2024: Stow Kd value gotten as: 0.00996399
Sun Apr 14 17:26:25 2024: Stow Ki value gotten as: 0
Sun Apr 14 17:26:25 2024: Stow Kp value gotten as: 3.99969
Sun Apr 14 17:26:25 2024: Timeout value gotten as: 0.1
Sun Apr 14 17:26:25 2024: Velocity FF0 value gotten as: 0
Sun Apr 14 17:26:25 2024: Velocity FF1 value gotten as: 0.0260925
Sun Apr 14 17:26:25 2024: Velocity FF2 value gotten as: 0
Sun Apr 14 17:26:25 2024: Velocity Kd value gotten as: 0
Sun Apr 14 17:26:25 2024: Velocity Ki value gotten as: 0
Sun Apr 14 17:26:25 2024: Velocity Kp value gotten as: 0.0249939
Sun Apr 14 17:26:25 2024: Voltage Slew Limit value gotten as: 10000
Sun Apr 14 17:26:25 2024: Voltage Slew Limit Enable value index gotten as: 1
Sun Apr 14 17:26:47 2024: Firmware file selected: /<path-to-firmware>/VERT-F2_0_0_0-M34_1-E20_0.zip
Sun Apr 14 17:26:49 2024: combined flash requested
Sun Apr 14 17:26:49 2024: flash initiated
Sun Apr 14 17:26:49 2024: flash starting at location: 0x8000000
Sun Apr 14 17:26:49 2024: waiting for motor to go in bootmode
Sun Apr 14 17:26:50 2024: module disconnected
Sun Apr 14 17:26:50 2024: CheckForAck: Not ACK - 

Any ideas as to how to proceed would be much appreciated. Thanks!

iq-fred commented 6 months ago

Hello, I've been looking into this issue to see if I can replicate it. I took the same module type as your log indicates you used, and tried flashing it from the Speed firmware to the Position firmware on the website using Control Center v1.5.2. I've included a quick screen capture demonstrating this process, just to show that it worked as expected on my setup. This was all performed on Windows, so if you are on a different OS it may not be directly applicable, and we can try to re-test with the appropriate OS.

https://github.com/iq-motion-control/iq-control-center/assets/95372252/864c0e1c-0b8b-4342-92c6-734b47011afc

In that video I went from our latest speed firmware, v0.0.1, to the position firmware, but I have also tested with going from speed firmware v0.0.0 to the position firmware, which matches what your log shows as your starting firmware. I also tried recovering from a failed flash attempt between these firmwares (speed v0.0.0 and servo v0.0.0), and was able to successfully recover the motor. So, based on these tests I don't think that the position firmware on the website inherently has a problem with flashing or recovery, or that the Windows version of Control Center v1.5.2 has problems flashing that firmware, or at least the steps to replicate an issue with them are more involved. What OS are you using? Were there any other steps prior to your flash that you think may have not have been captured in this testing? The log seems to indicate it was flashed immediately after connecting, was this the first time you had connected this module? Can you share any pictures or videos of the attempted recovery process so we can see if there is anything helpful that might not be showing up in the log?

The CheckForAck issue does typically indicate some kind of communication failure with the ST bootloader, so it may be worth at least double checking on your hardware setup to ensure that there are no issues there. Can you tell me more about how you are connecting to the module? Any details on the USB-to-UART device you are using? Can you provide any pictures of the setup or wiring details?

Have you tried flashing any other 40-06 modules on this setup and had similar issues, or is this the first time you've tried to flash a 40-06?

bmelanman commented 6 months ago

What OS are you using?

I originally encountered the issue on my M1 Mac, but the error persists on my Windows machine as well.

Were there any other steps prior to your flash that you think may have not have been captured in this testing?

Not from what I can tell; I connected UART and power, successfully connected the motor to IQCC, and then attempted to flash the firmware using the Flash Complete option, which resulted in the error.

Can you share any pictures or videos of the attempted recovery process so we can see if there is anything helpful that might not be showing up in the log?

I'm having some iCloud issues that are making it difficult to upload a video right now, let me know if you think a video would be necessary to help diagnose and I'll try my best to get one uploaded sometime soon.

Can you tell me more about how you are connecting to the module? Any details on the USB-to-UART device you are using? Can you provide any pictures of the setup or wiring details?

The module is being powered by a 12V5A supply, and its connected to the UART pins of a FlipperZero which is connected to my computer via a USB-C cable.

I have successfully connected to the module and edited settings using IQCC (i.e. I have been able to change the module ID to 1 from the default ID of 0), so I would assume that the UART connection is fine (though I won't make a fuss if you find it necessary to try a different device).

The log seems to indicate it was flashed immediately after connecting, was this the first time you had connected this module? Have you tried flashing any other 40-06 modules on this setup and had similar issues, or is this the first time you've tried to flash a 40-06?

The logs are from an attempt to only connect to the module and then flash it (with 1-2 seconds of wait between each step from clicking, navigating, etc...).

This is my first try at flashing a 40-06 module, however believe I have successfully flashed a few 23-06 modules on this setup before (though I might have just been editing settings rather than flashing new firmware, I can't exactly remember). I can try flashing a 23-06 module again if you think it would be helpful, just let me know.

Thanks again for the help btw, its much appreciated!

iq-fred commented 6 months ago

@bmelanman Thanks for that additional info

Seems like it isn't an issue specifically with the Mac release of Control Center then if you replicated it on Windows.

With debugging these kinds of issues, it can be hard to tell what sort of information might be useful for cracking it open, so if its not too much trouble a video would be good just so we can see everything you're seeing, might notice something that differs from when I'm trying this out on my bench. Pictures of your hardware setup could also be good for comparison to mine if possible.

Being able to communicate to configure settings with the Control Center doesn't necessarily mean that their will be no issues with the UART when flashing. When we are flashing, we jump into the pre-loaded ST bootloader, so the UART configuration/operation won't be quite the same as when you are running our application code. Also when flashing with the ST bootloader it's transferring a lot more data in sequence than configuring a parameter, so if there are intermittent communication issues that are occurring they may be more likely to crop up during flashing. Of course at this point I can't say whether your problem is related to the communication hardware setup, I just can't rule it out either.

If you have one available, can you try connecting/flashing with a different piece of hardware than the Flipper Zero? I've been using and we typically recommend something like this: https://www.amazon.com/Ximimark-Module-Serial-Converter-CP2102/dp/B07T1XR9FT? . That would be ideal so we can have the exact same setups, but if you don't have anything else like that around, comparing with whatever you do have available could be useful. Just trying to isolate what the difference between our setups might be to help me replicate the issue.

If you could try flashing a 23-06 module for comparison, that could also give us some useful information.

Thanks for working with us as we try to get to the bottom of this issue!

bmelanman commented 6 months ago

Problem Solved!!!

It seems that the issue was unfortunately with my choice of USB-to-UART device, and after switching to using a simple pico-uart-bridge, IQCC was more than happy to flash my modules with the updated firmware.

That being said, this was still a very odd (and frustrating!) issue, so feel free to continue investigating if desired, otherwise this issue can be closed.

Thanks again for all the help!!!

iq-fred commented 6 months ago

Glad to hear you were able to get it flashing with some different hardware! I'll add a task for the future to try and evaluate why the FlipperZero might have had trouble with the ST Bootloader, but for now, I'll mark this as closed.