Q about AVCC and AGND

I am using an analog joystick with 10K potentiomenters to control both motors - using analog inputs on GPIO3 & 4.

Should I connects to potentiometers to 3.3V & GND on pins 1 & 2 or to AVcc and AGND?

I am seeing a lot of noise on 3.3V and as a result the motors keep spinning at a slow speed when the joystick is in neutral position.

Also, is there an easy method to create a dead zone in the neutral position so that vel_setpoint is 0 unless the joystick moves by a certain amount?

Thanks,

Anil

You should use AVCC and AGND. They are meant for analog signals.
Sorry we don’t have a deadzone feature, but that has been requested by others as well and we will consider adding it as a feature in the future.

Thanks Oskar.

I am using the Analog Vcc now but still need the dead zone. I have brute forced a guard band for ‘fraction’ variable in analog control routine. Seems to work. However if the guardband is too wide (say from 0.45 to 0.55 for fraction), the motors seem to run and stop abruptly. Have not analyzed the errors when that happens.

I would like to implement an ‘enable joystick switch’ by adding a physical switch to GPIO input. Which GPIO do you recommend for that and is there reference code already in place for such a switch?

Anil

You can change the code to make the response curve start from zero when it engages.

There have been some requests for an enable input, but we don’t have anything like that yet. You could make it yourself. Search the codebase for inspiration, search for HAL_GPIO_ReadPin.