Monday, 25 February 2013

SL upload issues

I had a SL board that wouldn’t upload new firmware, so I decided to diagnose what was going on.

All I could could get was sync errors.

I had no idea as to the state of this SL so I started from the beginning. 


First some background

The SL is meant to have a boot loader on it. When the MPU is reset the boot loader is run, it is at this stage that you can upload new firmware from the arduino IDE.

The MPU reset line is tied to the DTR serial line on the FT232RL chip. Pin 2, this gives software the ability to reset the MPU using a simple serial port command.

The first thing was to check the boot loader was running.

The Standard boot loader toggles an IO line during boot up, unfortunately on the SL this is connected to E-DIR. So we cant see what is going on.

I did not want to remove my E Pololu so I went for a software fix.

I changed the port in the bootloader to one of the spare ports on the IO header. I changed it to D4.
NB this is incorrectly labeled on the SL board as D12






I compiled and uploaded the new boot loader.
I connected a resistor and led between pins  D4 and GND. NB LED's have polarity, if you need help with this see http://www.ladyada.net/learn/arduino/lesson3.html


I reset the board and it flashed as expected. So the boot loader does run. So the boot loader is fine and the fuses are probably ok.

I started up Arduino, set everything correctly, and hit upload. Nothing.
Including no flashing led!, so the software controlled reset was not happening.

I decided I didn’t want to have to load up Arduino every time I wanted to try and test the reset so I wrote (ok cut and paste bits from the internet) into a quick python script to toggle the DTR line.

***********setdtr.py*****************

import serial
from time import sleep

conn = serial.Serial('/dev/ttyUSB0',
                     baudrate=57600,
                     bytesize=serial.EIGHTBITS,
                     parity=serial.PARITY_NONE,
                     stopbits=serial.STOPBITS_ONE,
                     timeout=1,
                     xonxoff=0,
                     rtscts=0
                     )
conn.setDTR(True)
sleep(3)
conn.setDTR(False)
sleep(5)
conn.close()
**************************************

Next I checked the hardware.

The DTR line is pin 2 of the small surface mount chip on the back.
I tested it with a multimeter and under a 10x magnifying glass. Looked fine.

I checked Jumper "auto reset" had continuity, yip.
I checked Pin 9 of the MPU, Reset, had continuity to the jumper, yip.
I re-soldered cap C7, no change
I re-soldered the jumper and MPU pins, no change.

Getting frustrated, I re-soldered pin 2 on the FT232RL, Success!!!

The board now resets when I run setdtr.pl and flashes its little LED as it should.



I can only surmise that the underside of pin 2 was dry, and when I tested it with the multimeter the probe pushed the pin onto the PCB making a connection that wasn’t actually there, and I need better than 10x magnification to see this.

I then used Arduino, set it up, hit upload and after compiling the code, the board resets, the LED flashes and the code uploaded!

Success!!

No comments:

Post a Comment