Autosteer on the Arduino Nano Every

I didn’t fully evaluate my decision to purchase a Nano Every and it turns out they aren’t quite compatible with Autosteer without modifications.

Anyways, to get support in the IDE, you have to install the Arduino megaAVR Boards package in the Board Manager, and then select the every as the correct device, as so:

nano_every

Then use the regular USB firmware from the Support_Files ZIP on release, except replace Autosteer_USB_4.3.10.ino with the file in this github gist.

All I did was remove the 50kHz I2C setting and swapped out the PWM frequency configuration for a config that’s valid on the Nano Every.

A few caveats ATM:

  • I’ve only tweaked the USB version, although I assume you could apply the same changes to the UDP version as well. I don’t have the hardware to test so I’m not doing it.
  • This does not support the IBT2, you can only use it with the cytron driver (or a PWM/DIR driver anyways), D4 is not PWM-capable on the Nano Every.
  • I2C is now running at 100kHz which IMO should be fine but could be an issue if problems have been seen at that speed.

If you look in the board manager there are legacy settings for the Every, compatible with the original nano pinout and processor speed.

For other projects you can use the megacorex board library to get a second hardware uart on the Every too.

Yep, although unfortunately the emulation layer doesn’t cover the I2C and timer registers that are directly written to by the autosteer code, hence the changes.

can you delve a little deeper into this topic?

Which part of it?

The Nano every is the new version of genuine Arduino hardware. It is capable of running up to 20mhz vs 16Mhz. For the most part apparently, the legacy setting for the compiler will run original nano programs at the 16mhz clock rate with a comparable pin out to the original nano.

There is a special board library on git hub for it called megacoreX that makes it vastly more useful, and gives it a second Hardware uart not enabled by Arduino.

nanolibrary

Looks like legacy may be better handled in MegaCoreX as well.
Watch out for the Ali Every clones, they need to run the “Thinary library” and are next to useless.

do you think there could be problems compiling the autosteer sketch with maegacoreX? the second serial would be very useful for connecting the Vesc motor controller, without having to resort to the SoftwareSerial

I tried to run the new usb autosteer on the nano every with the MegaCoreX and the clock at 20 MHz, the serial communication does not work, the same sketch with the clock at 16MHz works … any ideas?

I have my PCB working with the nano every thanks to Davids code. Does anyone else suffer a slow down in data getting to AOG if you enable the Inclinometer?

Some baud rates are incompatible with certain processor frequencies, that could be causing issue.

http://ruemohr.org/~ircjunk/avr/baudcalc/avrbaudcalc-1.0.8.php

But it looks like 20MHZ should be good.

Not sure if AOG has timed events millis() in the code, but that also has to be scaled, or at least the processor speed defined somewhere in the code.

Seems to me that the only millis() is for the freq of the main loop, if I don’t change it, the code will only run faster I think…

Hello! Is there a later version of this modification available? I’m trying to get the USB-Version 5.0 to work with the nano-every board, but it dosen’t really work as of now.

Thanks!