0
\$\begingroup\$

I am new to microcontrollers (not electronics) and build a Shrimp except using CP2102 I am using a FT232RL UART. I am not using DTR connection for auto-reset, because it is not connected on my cable.

My circuit itself works fine. Using an ISP-Programmer (AVR Dragon) with AVR Studio 6 it is possible to flash any code. With this setup I flashed optiboot-bootloader onto my ATmega328P. It looks like it is working correctly, because after pressing RESET a LED connected to D13 (PB5) flashes three times.

Sadly, when using Arduino IDE trying to upload the "Blink"-Sketch, I get the following error:

Binary sketch size: 1.084 bytes (of a 32.256 byte maximum)
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P/dev/tty.usbserial-A4VXM4PQ -b115200 -D -Uflash:w:/var/folders/yp/trpfnkdn75zfzpl33tyw0tpm0000gn/T/build3725234357197838286.tmp/Blink.cpp.hex:i 

avrdude: Version 5.11, compiled on Sep  2 2011 at 18:52:52
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/user/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/tty.usbserial-A4VXM4PQ
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

avrdude done.  Thank you.

Searching the internet for hours all I can find is "check your wires" or "maybe bad bootloader or chip broken". I can say the chip is not broken because it works with AVR Studio and I do not think the bootloader is broken. I downloaded the latest version from code.google and also tried the .hex delivered with Arduino IDE. My wiring is quite simple just connected GND, Rx and Tx of FT232RL like the Shrimp schematic states. Checked everything multiple times and asked an engineering friend (but he is not familiar with Arduino in detail) to check it too… We both found no wiring error.

I also tried different timings from -10 to +10 seconds in relation to pressing RESET, but that did not fix anything. Also my USB-to-Serial cable is tested and working with different devices (RasPI, Cisco Router and other devices). In Arduino IDE the corresponding tty-device is selected. Board setting is set to "Uno".

What can I do to finally get my sketches onto my chip with serial and fix this problem to end my odyssey?

\$\endgroup\$
2
\$\begingroup\$

While building an arduino I experienced similar issues. It came down to two things:

1) Some circuit error on the bootloader TX/RX lines that had an accidental short and caused it to not respond

2) Bootloader file I used was incorrect, despite the fact that it downloaded perfectly fine and transmitted and all the instructions told me to use that one. The issue was something in the configuration that apparently changed the baud rate and hence the BSL failed.

I recommend you use a logic Analyzer or Oscilloscope to look at the lines and see what is going on. Some of the things you need to look for is:

1) No Data and lines don't start in their default state

2) Baudrate or speed incorrect

\$\endgroup\$
  • \$\begingroup\$ Sadly I don't have a scope neither logic analyzer :-( I did add some LEDs to Rx/Tx at some point. Tx (from FT232) flashed when trying to upload. I took my multimeter to check my wiring for any short on Rx/Tx with 6.85 MΩ as result => no short. I first used .hex-file as found here: goo.gl/J0nbX and after that I used hardware/arduino/bootloaders/optiboot/optiboot_atmega328.hex as found with Arduino IDE \$\endgroup\$ – Mose Dec 27 '12 at 22:40
  • \$\begingroup\$ Ok. It's funny because the issue you describe is exactly what happened to me. TX would blink but not RX, meaning there was no communication back. Do both lines measure High when there's no communications on them? Are you using a different crystal frequency? Perhaps you accidentally used a similar but different ATMega than the one that the hex file was build (There were some differences between ATMega328PU and other non PU devices). Try a couple of other hex files. \$\endgroup\$ – Gustavo Litovsky Dec 28 '12 at 0:18
  • \$\begingroup\$ Just noticed that your original post confirmed perhaps. You have ATMega328P which isn't exactly PU (which the Shrimp uses). See this post for some info: avrfreaks.net/… \$\endgroup\$ – Gustavo Litovsky Dec 28 '12 at 0:20
  • \$\begingroup\$ It's ATmega328P-PU. On shrimping.it they state 328-PU or 328P-PU are ok. My signature is 0x1E950F which should be alright after reading your linked thread on avrfreaks. Measuring on both lines with my multimeter shows that without connection in idle RL232 side Rx is about 5.01V and Tx staying at about 1.2mV. ATmega side Rx 1.01V and Tx 0.87V. When connected (refered from ATmega side) Rx 5mV and Tx 4.95V. Rx going up to 7.8mV when trying to upload. Tx staying the same. \$\endgroup\$ – Mose Dec 28 '12 at 8:26
  • 1
    \$\begingroup\$ I'm happy to hear you got it working. \$\endgroup\$ – Gustavo Litovsky Dec 29 '12 at 1:15
2
\$\begingroup\$

Hurrah. Also glad to hear it wasn't an issue with our schematics at http://shrimping.it.

The ser_recv() error you describe is a really generic error by the way, which could easily be created by any issue in the serial wiring at all. A classic which I personally always do, is just wiring TX and RX the wrong way round, which looks just the same.

@ShrimpingIt has been using the ultra-cheap CP2102 modules from China without issue (although important to get the ones you can solder a DTR pin onto). Never pursued using the FT232 modules as they seem overkill for this job.

The Optiloader program autodetects the ATMEGA328 family and can handle flashing the Optiboot bootloader (i.e. Arduino Uno bootloader) without hassle and everything seems to work fine.

However, we have a keen ear and eye out for any issues which people are experiencing with our instructions and aim to update them and improve them if possible when people hit a roadblock of some kind so let us know if there's any changes we can make.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.