You are here

REVERSE FAIL in ADC_CURRENT_REV_BUTTON_BRAKE_ADC 

5 posts / 0 new
Last post
dk-odense
Offline
Last seen: 1 year 8 months ago
Joined: 2017-09-06 08:01
Posts: 8
REVERSE FAIL in ADC_CURRENT_REV_BUTTON_BRAKE_ADC 

Hi All

I am having aproblem with my fully FW updated VESC 75/300 R2. When i am choosing "current reverse button" in vesc tool, i am able to reverse the motor by putting gnd to servo input.

But when i am choosing "current reverse adc2 brake button" the same input does not reserve the motor. It functions as Cruise Control (keeping the speed as long as i set the input).

I am building a gokart and the possibility to reserve would really be a win. The project: https://www.youtube.com/watch?v=k5flv72Oivc

I spent a couple of hours looking into the code anyway. I think i found a fault. Now the code looks like this:

 

Should it not be looking like this, when i am using ADC & UART, with ADC1 as trottle and ADC2 as brake and a button to reverse the throttle to reverse (just like normal CURRENT_REVERSE function)?

I need the vesc to reverse, when i set the PPM input. It works great in CURRENT_REVERSE, but not in ADC_CTRL_TYPE_CURRENT_REV_BUTTON_BRAKE_ADC 



 



 

benjamin
Offline
Last seen: 5 days 10 hours ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490

I will look into it, should be quite easy to fix.

Rich235
Offline
Last seen: 3 months 1 week ago
VESC Free
Joined: 2024-08-30 06:58
Posts: 4

Hello, I am having exactly this same issue with FW 6.05.

Using ADC and UART, "current reverse button" works perfectly with reverse to ground connected to servo pin. Data over UART to dash display works fine. I can go forward and reverse with nice throttle control. So, reverse button connected to servo pin with UART enabled is working OK.

With: "current reverse adc2 brake button" using brake pedal on ADC2, regen-brake works well. However, now reverse does not work. Inverting the reverse pin in the VESC Tool  makes no difference, so I assume it is ignoring the reverse input. The help text suggests this should work but does not.

Benjamin, may I ask if you were able to look at this issue as per the previous poster please? At the moment, I can't find any other VESC Tool configurations to adjust to make this work for a car application with forward, reverse, regen braking in both direction and a UART display. But all modes work perfectly on their own.

I can provide any further information that may help resolve this.

Thank you so much. Kind regards, Richard.

 

Unable to stop making outlandish items.

Rich235
Offline
Last seen: 3 months 1 week ago
VESC Free
Joined: 2024-08-30 06:58
Posts: 4

Looking deeper at the APP code like dk-odense did earlier, I do think there is a config missing:

In: bldc/applications/app_adc.c

Line 434            if ((config.ctrl_type == ADC_CTRL_TYPE_CURRENT_REV_BUTTON_BRAKE_ADC ||
                config.ctrl_type == ADC_CTRL_TYPE_CURRENT_REV_BUTTON_BRAKE_CENTER) && rev_button) {
                current_rel = -current_rel;
            }
            break;

We can see that with the config: ADC_CTRL_TYPE_CURRENT_REV_BUTTON_BRAKE_ADC it checks for rev_button status and reverses the current if reverse is selected. Great!

However, it is ignoring reading the reverse button for ADC_CTRL_TYPE_CURRENT_REV_BUTTON_BRAKE_ADC  as this config is missing from line 303-304:

From Line 288
// Read the button pins
        bool cc_button = false;
        bool rev_button = false;
        if (use_rx_tx_as_buttons) {
            cc_button = !palReadPad(HW_UART_TX_PORT, HW_UART_TX_PIN);
            if ((config.buttons >> 1) & 1) {
                cc_button = !cc_button;
            }
            rev_button = !palReadPad(HW_UART_RX_PORT, HW_UART_RX_PIN);
            if ((config.buttons >> 2) & 1) {
                rev_button = !rev_button;
            }
        } else {
            // When only one button input is available, use it differently depending on the control mode
            if (config.ctrl_type == ADC_CTRL_TYPE_CURRENT_REV_BUTTON ||
                    config.ctrl_type == ADC_CTRL_TYPE_CURRENT_REV_BUTTON_BRAKE_CENTER ||
LINE 303 - 304:

>>>>>>>>>>>>>>> MISSING: "config.ctrl_type == ADC_CTRL_TYPE_CURRENT_REV_BUTTON_BRAKE_ADC || " config here?? Otherwise brake button ignored?

                    config.ctrl_type == ADC_CTRL_TYPE_CURRENT_NOREV_BRAKE_BUTTON ||
                    config.ctrl_type == ADC_CTRL_TYPE_DUTY_REV_BUTTON ||
                    config.ctrl_type == ADC_CTRL_TYPE_PID_REV_BUTTON) {
                rev_button = !palReadPad(HW_ICU_GPIO, HW_ICU_PIN); << I need it to do this with brake on ADC2 please!
                if ((config.buttons >> 2) & 1) {
                    rev_button = !rev_button;
                }

So with this missing, it never gets to check the reverse button in this mode.

Please can this be checked and added in? I'd love to be able to do this myself but setting up this tool chain, modifying and building the firmware and then being confident this was not going to brick my hardware is a bit beyond me.

Hopefully this would also help others.

Thank you very much. I can then complete my son's ride-on car build.

Regards, Richard.

By the way, there may be a work around by writing a LISP function, but that is complete beyond me! 

Line 319: // Override button values, when used from LISP

Unable to stop making outlandish items.

Rich235
Offline
Last seen: 3 months 1 week ago
VESC Free
Joined: 2024-08-30 06:58
Posts: 4

As an update to this, I did load the tools to adjust and rebuild the firmware and can confirm the suggested addition in bldc/applications/app_adc.c does fix the problem. So, if anyone is seeing a lack of reverse when using ADC2 for regenerative braking, you will need to make this change until fixed. I'll try and raise an issue in Github.

 

Unable to stop making outlandish items.