Feather 328p cannot be programmed by Ubuntu host

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jamezracer
 
Posts: 7
Joined: Wed Sep 29, 2021 2:42 am

Feather 328p cannot be programmed by Ubuntu host

Post by jamezracer »

I am having difficulty programming the Feather 328p using the Arduino IDE in both Ubuntu 18.04 and 20.04 on two different PCs.

Code: Select all

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x00
The feather 328p hardware works to the extent that I can upload blink sketches from a windows computer, and I can read serial port prints on my Ubuntu machines at /dev/ttyUSB0. I have been able to upload sketches from Ubuntu at the ttyUSB0 port by manually pressing the 328p reset button during the upload phase. However this is unreliable and not sustainable.

Perhaps some timing issue with the CP2104 reset toggle? I also notice that the RX/TX indicator LEDs do not illuminate during programming or basic console prints.

Thank you for any advice. I've seen a number of threads with this issue and all seemed to be resolved by finding another serial port device (in OSX), replacing the unit, or suffering with toggling the reset button for each program.

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: Feather 328p cannot be programmed by Ubuntu host

Post by mikeysklar »

Can you provide a screenshot of your Arduino IDE Tools menu on the Ubuntu machine to confirm the Board / Processor / Bootloader / Port?

It sounds as though you have the setup working on all your machines. The reset button press during code upload can be timed with full verbose output watching the messages scroll passed.
Then, when uploading, you can see AVRDUDE sending three packets avrdude: Send: 0 [30] [20] (with corresponding RX flashes on the board) right before the avrdude: ser_recv(): programmer is not responding error.

User avatar
jwinslade
 
Posts: 44
Joined: Fri May 21, 2021 12:00 pm

Re: Feather 328p cannot be programmed by Ubuntu host

Post by jwinslade »

I had one 328p which REFUSED to program under Ubuntu, but other boards programmed fine. They replaced that one under warranty.

I've used quite a few 328p boards on some model railroad projects and they usually program fine under both Ubuntu and Windoze.

User avatar
jamezracer
 
Posts: 7
Joined: Wed Sep 29, 2021 2:42 am

Re: Feather 328p cannot be programmed by Ubuntu host

Post by jamezracer »

mikeysklar wrote:Can you provide a screenshot of your Arduino IDE Tools menu on the Ubuntu machine to confirm the Board / Processor / Bootloader / Port?

It sounds as though you have the setup working on all your machines. The reset button press during code upload can be timed with full verbose output watching the messages scroll passed.
Then, when uploading, you can see AVRDUDE sending three packets avrdude: Send: 0 [30] [20] (with corresponding RX flashes on the board) right before the avrdude: ser_recv(): programmer is not responding error.

I've attached a screenshot with the output with verbose programming mode. I get no RX/TX flashes on the board. The board will be embedded in an enclosure so pressing the reset button will not be possible for this project.
Attachments
Screenshot from 2021-10-03 16-44-55.png
Screenshot from 2021-10-03 16-44-55.png (78.17 KiB) Viewed 144 times

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: Feather 328p cannot be programmed by Ubuntu host

Post by mikeysklar »

Alright, this sounds like a stuck bootloader.

Did you purchase this board from Adafruit in the last month?

User avatar
jamezracer
 
Posts: 7
Joined: Wed Sep 29, 2021 2:42 am

Re: Feather 328p cannot be programmed by Ubuntu host

Post by jamezracer »

mikeysklar wrote:Alright, this sounds like a stuck bootloader.

Did you purchase this board from Adafruit in the last month?
Am I able to update the bootloader over USB on this board or would I need another arduino to act as a programmer like the Uno boards?

Yes, ordered about 2 weeks ago, order # 2661402

Thank you for your quick responses! :)

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: Feather 328p cannot be programmed by Ubuntu host

Post by mikeysklar »

Looking back at the guide it reminds to ask you if you tried setting the board to the Arduino Pro Mini. Probably not the issue, but depending on how you setup your installation it could make a difference.
From the Tools menu, select Tools -> Boards -> Arduino Pro or Pro Mini
From the Tools menu, select Tools -> Processor -> ATmega328P (3.3V, 8MHz)
The bootloader needs to be updated over ISP. It would require another Arduino or ISP programmer.

If the above is not going to work for you please send an e-mail to [email protected] requesting a replacement / refund for this board. Include this forum link and your order#.

User avatar
jamezracer
 
Posts: 7
Joined: Wed Sep 29, 2021 2:42 am

Re: Feather 328p cannot be programmed by Ubuntu host

Post by jamezracer »

mikeysklar wrote:Looking back at the guide it reminds to ask you if you tried setting the board to the Arduino Pro Mini. Probably not the issue, but depending on how you setup your installation it could make a difference.
From the Tools menu, select Tools -> Boards -> Arduino Pro or Pro Mini
From the Tools menu, select Tools -> Processor -> ATmega328P (3.3V, 8MHz)
The bootloader needs to be updated over ISP. It would require another Arduino or ISP programmer.

If the above is not going to work for you please send an e-mail to [email protected] requesting a replacement / refund for this board. Include this forum link and your order#.
Yes, I've tried setting the board to both Pro/Pro mini (3.3v@8mhz) as well as the Adafruit custom 328p feather board. Both have the same behavior.

Thanks, I'll contact the support email as I don't have another arduino to set up as an ISP programmer.

User avatar
jamezracer
 
Posts: 7
Joined: Wed Sep 29, 2021 2:42 am

Re: Feather 328p cannot be programmed by Ubuntu host

Post by jamezracer »

I received a replacement board but unfortunately the behavior is the same.

User avatar
jamezracer
 
Posts: 7
Joined: Wed Sep 29, 2021 2:42 am

Re: Feather 328p cannot be programmed by Ubuntu host

Post by jamezracer »

Update: I am able to reset the 328p and bring up the bootloader from Ubuntu over USB by inducing a falling edge on the DTR line via ioctl which is what I believe the programmer is be doing.

fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY);
int flag = TIOCM_DTR;
ioctl(fd, TIOCMBIS, &flag);

This induces the same 3 red led flashes that are induced by manually pressing the reset button and or a failed attempt to program. This leads me to think the Linux Arduino IDE or the feather bootloader have some mismatch in timing the wait after reset.

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: Feather 328p cannot be programmed by Ubuntu host

Post by mikeysklar »

@jamezracer,

Do you have another system you can program from either a Raspberry Pi running Pi OS or Win/MacOS machine? I'd like to verify that the failed programming behavior follows.

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”