I am trying to upload Marlin 1.9 to an Anet A6 3D printer. When the upload appears to be nearly finished it fails saying (repeatedly) the “the programmer is not responding”.I wonder if the problem is that my hex file is too big for the available memory, as the reason I am trying to upload it, is to add a feature to the standard setup. The Anet A6 control board uses an ATMega 1284p processor which should, I think, have just enough memory if the Optiboot bootloader is installed, but I don’t know which bootloader the A6 uses. Another reason that I think this is the problem is that, after this failure, the A6 will not boot up, so I suspect the bootloader has gone. I am reluctant to just try to reflash the bootloader, as I have already tried all this on another board, which is now completely bricked after tryin to reflash Optiboot.
Here is the output from the Marlin compilation. Unfortunately I did not copy the output from the upload, though I took a screenshot, but there doesn’t seem to be any way to attach the image file.
Further to my post, here is a transcription of the output from avrdude when it tries to upload the firmware, which I hope will help diagnose the problem. It appears that avrdude outputs 50 #s when reading the file but fails after outputing 49#s when writing it.
Configuring upload profile…
AVAILABLE: arduino
CURRENT: upload_protoco; = arduino
Looking for upload port…
Use manually specified: /dev/cu.wchusbserial1410
Uploading .pioenvs/sanguino_atmega1284p/firmware.hex
avrdude: AVR device initialised and ready to accept instructions
Writing | #################################################avrdude:stk500_rec(): programmer is not responding
avrdude:stk500_rec(): programmer is not responding
avrdude:stk500_rec(): programmer is not responding
etc.
We’d need to know with which exact settings you’ve flashed the bootloader. The chip should always be reprogrammable with an AVR programmer.
Can you upload via the pio run -t program command? It should not write a bootloader, just the bare firmware. Otherwise if you want to make sure the size of the firmware is the problem, can you reduce the size by disabling some features and uploading?
Thanks for your response.
I would try your suggestion, but I don’t know how to use the “pio run -t program” command. Could you tell me how to do this or give a link to a description?
Hugh McIntyre
Open a “PIO Terminal” (here) from the lower status bar and type the command in there. As I said, be aware that if you program it like this, it won’t have a normal USB bootloader anymore, but you can re-programm the bootloader anytime again using e.g. the Arduino IDE.
Thanks again. I tried this, first with “pio run -t program” , just to check that wouldn’t work, and then with “pio run -t .pioenvs/sanguino_atmega1284p/firmware.hex” which I thought might. I got the output below. I had my board connected to my Mac by its USB port when I did this. However the board still doesn’t work when connected to the printer, but I wasn’t surprised by this, as the output doesn’t give any indication that anything was uploaded. What am I doing wrong? Should I have connected the board through an ISP? Sorry to be so clueless, but I am completely new to this sort of thing and don’t know the basics.
Seems like current installations of openocd don’t install the needed dynamic libraries for MacOS. Can you try to install brew (https://brew.sh/, Installation — Homebrew Documentation) and then brew install openocd? Its dependeny should install the missing library for pio run -t program to go through.
Thanks again for your help. I don’t have access to my printer for the next two weeks, but when I do, I will try to install the missing library and post what happens. I take it, from your comment, that I should use the word “program”, not the file name, but I am still not sure whether to connect to my board by USB or through an ISP programmer.
Right the command is just pio run -t program, no filename needed
This. You may attempt also flash the board via USB as you have tried before, but you’ll just run into the problem of out-of-space due to the bootloader again. So I’d try via the ISP programmer. (SPI + RESET + GND)
HI Max. I could not get PlatformIO to recognise the port for my USBasp so I could not flash Marlin over the ISP link, but I finally got Marlin to compile and upload to my Anet A6 by using the Arduino IDE + USBasp to upload the Optiboot boot loader to the printer and then uploading Marlin from PlatformIO using the boot loader over the USB link. This final step is what I originally tried and I think it failed because my printer originally had a larger bootloader which didn’t leave enough room for Marlin.
Thanks again for all your help. I’m closing this topic now.