Hi, I just wonder how do you start with new HW.
Do you use preprogrammed ATmega2560 or flash the bootloader via ISP?
My story… I assembled my own PCB. Now I am not successful with the ISP - avrdude says : part number is wrong (and random). Perhaps the virgin/unprogrammed STM32 loads the SPI_U1 bus? So I should start here?
But I was successful with the ATmega16 and I see TX data on my scope. Unfortunately the avrdude is unable connect the ATMega2560 ??? missing bootloader in the ATMega2560 could be the reason ???
Yes I enjoy this part, fortunately I have 10 pcs.
Thanks for hints.
Jan
It’s been about 2 years since I built my Farmduino 2.0a board. Unfortunately, the project was then abandoned. It’s my turn now.
To give the ATmega2560 a bootloader, I used an Arduino Uno, which I turned into an ISP programmer. This is very easy to do with the Arduino IDE. Both creating the ISP programmer and burning the bootloader with this ISP programmer.
I flashed the ATmega16 with the Arduino-usbserial-atmega16u2-Uno-Rev3.hex.
And on the STM32 the encoder-tracker firmware has to be uploaded. It should be noted that encoder-tracker 1.0.1 must be used for Farmbot version 1.5 and encoder-tracker 1.0.2 for v1.6. Burning works with the SWD interface and an ST-Link programmer.
It looks like everything is working for me. The v1.6 in particular has the great advantage of being able to use the quiet mode. An absolute must.
Thank you Kalus, so you use the
ArduinoCore-avr/bootloaders/stk500v2/Mega2560-prod-firmware-2011-06-29.hex
as bootloader for the atmega2560 ?
The booloader blinks on GRE1 LED, but not periodically, looks like MCU resets during second period.
My fuses are probably wrong (H:0xD8, L:0xFF, E:0xFD), could you please share your fuses for the atmega2560 ?
The booloader blinks on GRE1 LED, but not periodically, looks like MCU resets during second period.
My fuses are probably wrong (H:0xD8, L:0xFF, E:0xFD), could you please share your fuses for the atmega2560 ?
Here the settings of my working board. I used Microchip Studio to read the values.
For atmega16u2 I failed. I installed (maybe wrong) firmware
sudo dfu-programmer atmega16u2:1,17 flash /media/data/tmp/proj/farmduino/fw.ATmega16/Arduino-usbserial-atmega16u2-Uno-Rev3.hex
but definetly with default fuses. This caused the farmduino is visible on USB as
lsusb
Bus 001 Device 009: ID 2341:0042 Arduino SA Mega 2560 R3 (CDC ACM)
Unfortunately clock for serial port is slow (default fuses 1MHz instead of 16MHz external crystal). So it transmits data from the atmega2560 but by wrong speed. I did try all predefined speeds but I see only 0xFF data or some mess. I was even unable to recover fuses as for 2560 or attach ISP programmer. My HVSP failed for some reason also - it see always some random messy chip ID.
So order new chip, replace, attach USB with dfu-programmer, set fuses for 16MHz and fash the FW as you is probably the solution.
btw. external USB/RS232-5V convertor for arduino-pro-mini works well when attached to atmega2560.
I was also unable to connect arduino IDE to the farmbot, but I solved this by using arduino mega2560 as temporary target. Afterwards I download the binary using stk500 and flash on farmduino by stk500. I see no reason to spend more time for this issue now… maybe farmduino fw update will force me in future.