more G-Labs products

Author Topic: Pro mini 3.3v programming issue  (Read 2911 times)

March 29, 2015, 08:42:59 AM
Read 2911 times

mrwiz

  • *
  • Information
  • Newbie
  • Posts: 2
Hello!
  I have my pro mini hooked up to my rasp pi like the how to video shows but I can not get a handshake between the two.  What extra configuration needs to be done to get the couple to be friendly? The pro mini powers on but does not do a reset when I try uploading a sketch.  Everything in the sketch and setup section is correct.. Or at least I think it is..  Any help is much appreciated!!!  Thank you!

March 29, 2015, 02:08:05 PM
Reply #1

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
In order for it to work, you've to setup this (use pin 13 instead of 11):

https://github.com/deanmao/avrdude-rpi

also wire arduino like this:

GND <--> Pin 6 (GND)
VCC  <--> Pin 1 (3v3)
RXI   <--> Pin 8 (TXD - GPIO#14)
TXO  <--> Pin 10 (RXT - GPIO#15)
GRN <--> Pin 13 (GPIO#21/#27)

Cheers,
g.

March 30, 2015, 09:35:58 AM
Reply #2

mrwiz

  • *
  • Information
  • Newbie
  • Posts: 2
HI!
Thanks for that pointer. ive done as the link says and i still have a problem with the handshake. log comes back saying the programmer wasnt responding and my pro mini still blinks a 1 blink per sec rate . any other follow ups on how to get my pro mini working?
 Thanks

March 30, 2015, 10:41:08 AM
Reply #3

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer

April 27, 2015, 07:51:57 AM
Reply #4

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I've read a few guides on how to connect the Arduino to RPi using the GPIO serial.  I hooked things up and everything matches your connections (and theirs).  I've set up avrdude and installed the autoreset scripts as suggested.  But, no matter what I try I can't get it to flash.  I keep getting the following error:
Code: [Select]
pi@raspberrypi ~/arduino $ make upload
for STTYF in 'stty -F' 'stty --file' 'stty -f' 'stty <' ; \
          do $STTYF /dev/tty >/dev/null 2>&1 && break ; \
        done ; \
        $STTYF /dev/ttyAMA0  hupcl ; \
        (sleep 0.1 2>/dev/null || sleep 1) ; \
        $STTYF /dev/ttyAMA0 -hupcl
/usr/bin/avrdude -q -V -p atmega328p -C /etc/avrdude.conf -c arduino -b 115200 -P /dev/ttyAMA0  \
                -U flash:w:build-cli/arduino.hex:i
avrdude-original: stk500_recv(): programmer is not responding

avrdude-original done.  Thank you.

Makefile:496: recipe for target 'raw_upload' failed
make: *** [raw_upload] Error 1
It looks to me like the autoreset code is not kicking in.  I assume this must be due to the pin designation, but maybe it's something else.  I set the pin to 13, 21, and 27 since I wasn't sure whether pin was the physical pin or the GPIO pin number.  there does not appear to be any difference between the results no matter which pin I select.  I have not tried pressing the reset button after compilation is complete but could if that is something that would help.  The RPi is located in the basement and I'm working off my laptop elsewhere.

May 04, 2015, 04:58:16 PM
Reply #5

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I spent some time over the weekend getting everything figured out.  The issue was 3 fold (at least) but I think there may be one issue remaining if I wanted to program the Arduino with HG.

1) permissions
2) GPIO pin
3) board settings

I downloaded the autoreset code from github assuming it was all set up correctly.  As it turns out, it was not but I thought I had it covered.  The file didn't seem to have execute permissions, so I added that.  But, beyond that, it will only work when executed by root.  So, I have to run via "sudo make upload".   Also, when running via sudo, the pi environment variables are not shared with root.  As a result, the "execute BOARD=..." was not accessible from root.  I added those statements to my makefile and it was happy again.

Second, the GPIO I was using was the actual GPIO number but the code was set up to use the header pin number.  I switched it and it was happy again.

Finally, I had an issue where once I was able to upload, I was not getting a connection to the board over serial.  I could upload the blink example with different flash rates correctly, but serial returned garbage.  I tried other baud rates with minicom and it turned out that the board was set to 8MHz instead of 16MHz so things were running at double speed.  Connecting to the board set to run at 9600 would work if I set minicom to 19200 (2x9600=19200).  I deleted the compiled files, updated the BOARD setting, and "sudo make upload".

Now ever thing works as expected!  HOWEVER, I have not yet tried with HG.  Does HG use "make upload" or "sudo make upload"?  If it uses the first, I won't be able to get it to work.  I don't plan on changing things on the Arduino once setup, so this is not critical but would be good to know.