vedderb / vesc_tool

The source code for VESC Tool. See vesc-project.com
GNU General Public License v3.0
694 stars 507 forks source link

[Feature request] Allow reconfiguring I2C pins as ADC #294

Open totosolat opened 1 year ago

totosolat commented 1 year ago

Hi,

I am using a VESC V6 edu for robotics applications and I would need one extra ADC for a torque sensor analog output (I already use the two available ADCs for SIN/COS control)

I noticed the two pins "SCL MOSI TX" and "SDA NSS RX" could be used as ADCs. When I2C is not used, we could make 2 extra ADCs available.

Do you think it could be done? Do you think it would be an interesting feature for everyone or a too specific mod?

Thank you

Teslafly commented 1 year ago

It could be done. But making it universal to all vescs Is the hard part as not all have the same connections to those pins.

The particulars of vesc adc scanning can also be complicated to make universal as each hardware defines its own adc scan list. I have been thinking that you could probably change it so the stm32 always scans all the adc pins and just doesn't use some readings. Especially if the pin isn't in adc mode. This would make adding additional analog inputs easier.

But it still requires hardware config knowledge that is not universal.

I have the use case using the RX/TX pins where I want to use those adc's for a sin/cos encoder so I do not clobber the analog throttle input.

This is probably a long time coming though. So in the short term I would encourage you to edit the firmware and implement it on your own. Or use an external microcontroller.