Friday, December 6, 2013

3.3v boot-loader for Arduino

I have not done too much on this Regulator project as of late, as we have been busy with visitors and visiting too many coffee shops.  But I did play around some with solving the 3.3v boot-loader challenge.  Turns out it is really simple, and the Arduino Pro comes in a 3.3v/8Mhz version using the Amtel 328P micro-controller.

I found this Sparks-of-fun forum posting that covered ALMOST all of what was needed:  https://forum.sparkfun.com/viewtopic.php?f=32&t=27960, but there is one detail that bothers me:  5v to 3.3v signal levels...   As written the author is directly driving the poor target (running at 3.3v) from the 5v output pins on the hosting Uno.   I am sure for short bursts it will work OK, but it is stressing things a bit, so here is what I did:



 Just used a couple of resister dividers to bring the 5v down to 3.3v land.  Needed to do this for the MOSI (Master Out Slave In) as well as the SCK pins.   I used 470ohm and 1K ohm resisters, but you can try any 1:2 ratio resister you have around.   Note that the Reset pin does not need this, as the Amtel Reset pin is torrential to voltages 2x of Vcc!  (Which is also why there is no clipping diode on the reset circuits).

Once I had the voltages right, I fired up the Arduino ICE programming environment and:
  1. From the Menu bar, select Tools/Board and make sure it says Arduino Uno (or what matches the host board you are using)
  2. Press the Open Sketch button, scroll down and find the ArduinoISP.  Select that to upload the ISP firmware into the host board (the Uno in my case).
  3. Go back to Tools/Board, and this time select: "Arduino Pro or Pro Mini (3.3v, 8Mhz) w/ATmega 328"
  4. Select Tools/Programmer and make sure "Arduino as ISP' is checked
  5. Now, do Tools/Burn Bootloader

And that should be it!   From now on you will need to make sure you have the correct board selected (Tools/Board) as you move back and forth between the 3.3v environment use don the regulator and the 5v Uno boards.   But at this point the Arduino boot loader should in the regulators CPU, and you should be able to load sketches.  I of course always try BLINK first (adjust the port number to 8 to match where the LED is on the regulator board).



So, there you have it.  3.3v Arduino bootloader all programmed and ready to go!  I just need to finish soldering up the PCBs, and then start uploading the new firmware and testing things out.  Given we are in port though perhaps the end of February, my 'test bed' is a little unavailable.   But I expect after the 1st of the year I can start make some small runs here at Dock.

And a side note:  When I 1st tried to do the above, it did not work.  Reason being I had already loaded the Amtel CPUs with the normal (5v) bootloader, and the Brown Out fuse prevented the CPU from operating on 3.3v.  My workaround was to power the regulator from 5v vs. 3.3v.  That allowed me to load the bootloader and now all works well as 3.3v    If you are using Fresh CPUs, you you should not have this issue though.








No comments:

Post a Comment