Showing posts with label arduino. Show all posts
Showing posts with label arduino. Show all posts

Safer Sparkfun Pro Micro

Sep 7, 2019
I needed an Arduino type board that had these requirements
  1.  Fused
  2.  Protected digital outputs.
  3.  IO was 3.3V
  4.  Rugged USB.
Fused
I didn't want the Arduino to consume all the power if there was a short.

Protected Digital Outputs
If an output was directly connected to ground I didn't want that pin to be shorted out and fail.

IO 3.3V
Everything is 3.3V now.  Sensors, serial ports, Bluetooth is all 3.3V.  I didn't want to have to put level translators everywhere.

Rugged USB
I needed a through-hole well-supported USB connector for repeated plugging and unplugging.

Sparkfun produces the Pro Micro in a 3V/8MHz variant, but its small form factor did not allow any fusing or other protections.

So I made my own based on firmware provided by Sparkfun for the Pro Micro 3V/8MHz.


Highlights:
  • Fused to 750mA
  • Dx IO protected by 100-ohm resistor
  • 3.3V operation
  • All IO fully broken-out
  • Programming Header
  • Through-hole USB B full size
  • All components on Top side and had solderable
  • All the standard IO broken out to Dual Female Header for two connections per pin
  • 5cm x 5cm board (dirtypcb.com compatible) two-layers only


I left off the Reference Designators for the part because of the end-user.  There aren't many different components so building it isn't too difficult.

To program the bootloader, use my previous post Program Raw Atmeg32u4 to Sparkfun Pro Micro 3V/8MHz Bootloader

To program with Arduino IDE use Sparkfun Pro Micro 3V/8MHZ Installing the Arduino Addon.

I have extra PCBs that were made but not used.  Contact me through the Contact page

Read more ...

Hi-speed Arduino IDE FTDI programmer

Aug 22, 2018
If you were able to program using  Program RawATMEGA32u4toSparkfun Pro Micro directions, then add it to the Arduino Tools->Programmer menu.

This will also allow you to upload your sketch into the entire memory (without the bootloader) with command Sketch->Upload Using Programmer

Modify file "programmers.txt" in C:\Program Files (x86)\Arduino\hardware\arduino\avr
## FTDI BitBang
ftdislow.name=FT232R Low Baud Programmer
ftdislow.protocol=ftdi
ftdislow.speed=4800
ftdislow.program.extra_params=-B 115200 -P ft0
ftdislow.program.tool=avrdude

Move your avrdude.exe from the last post to 
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin

Move your avrdude.conf from the last post to
C:\Program Files (x86)\Arduino\hardware\tools\avr\etc



Program with Upload with Programmer

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega32u4 -cftdi -B 115200 -P ft0 -Uflash:w:C:\Users\jeremyh\AppData\Local\Temp\arduino_build_127873/REV-B.ino.hex:i 

avrdude: Version 5.10, compiled on Dec 19 2010 at 22:24:28
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : ft0
         Using Programmer              : ftdi
         Setting bit clk period        : 115200.0
avrdude: BitBang OK 
avrdude: pin assign miso 3 sck 1 mosi 0 reset 4
avrdude: drain OK 
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10     8    0 no       1024    8      0  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : ft245r
         Description     : FT232R BitBang Programmer

 ft245r:  bitclk 115200 -> ft baud 57600
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% -0.00s

avrdude: Device signature = 0x1e9587
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
 ft245r:  bitclk 115200 -> ft baud 57600
avrdude: reading input file "C:\Users\jeremyh\AppData\Local\Temp\arduino_build_127873/REV-B.ino.hex"
avrdude: writing flash (5648 bytes):

Writing | ################################################## | 100% 2.39s

avrdude: 5648 bytes of flash written
avrdude: verifying flash memory against C:\Users\jeremyh\AppData\Local\Temp\arduino_build_127873/REV-B.ino.hex:
avrdude: load data flash data from input file C:\Users\jeremyh\AppData\Local\Temp\arduino_build_127873/REV-B.ino.hex:
avrdude: input file C:\Users\jeremyh\AppData\Local\Temp\arduino_build_127873/REV-B.ino.hex contains 5648 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.00s

avrdude: verifying ...
avrdude: 5648 bytes of flash verified

avrdude done.  Thank you.


---------------------------------------------------------------------------------------
Burn Bootloader 
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega32u4 -cftdi -B 115200 -P ft0 -Uflash:w:C:\Users\jeremyh\AppData\Local\Arduino15\packages\SparkFun\hardware\avr\1.1.10/bootloaders/caterina/Caterina-promicro8.hex:i -Ulock:w:0x2F:m 

avrdude: Version 5.10, compiled on Dec 19 2010 at 22:24:28
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : ft0
         Using Programmer              : ftdi
         Setting bit clk period        : 115200.0
avrdude: BitBang OK 
avrdude: pin assign miso 3 sck 1 mosi 0 reset 4
avrdude: drain OK 
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10     8    0 no       1024    8      0  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : ft245r
         Description     : FT232R BitBang Programmer

 ft245r:  bitclk 115200 -> ft baud 57600
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
 ft245r:  bitclk 115200 -> ft baud 57600
avrdude: reading input file "C:\Users\jeremyh\AppData\Local\Arduino15\packages\SparkFun\hardware\avr\1.1.10/bootloaders/caterina/Caterina-promicro8.hex"
avrdude: writing flash (32758 bytes):

Writing | ################################################## | 100% 13.67s

avrdude: 32758 bytes of flash written
avrdude: verifying flash memory against C:\Users\jeremyh\AppData\Local\Arduino15\packages\SparkFun\hardware\avr\1.1.10/bootloaders/caterina/Caterina-promicro8.hex:
avrdude: load data flash data from input file C:\Users\jeremyh\AppData\Local\Arduino15\packages\SparkFun\hardware\avr\1.1.10/bootloaders/caterina/Caterina-promicro8.hex:
avrdude: input file C:\Users\jeremyh\AppData\Local\Arduino15\packages\SparkFun\hardware\avr\1.1.10/bootloaders/caterina/Caterina-promicro8.hex contains 32758 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 11.51s

avrdude: verifying ...
avrdude: 32758 bytes of flash verified
avrdude: reading input file "0x2F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x2F:
avrdude: load data lock data from input file 0x2F:
avrdude: input file 0x2F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lock verified


avrdude done.  Thank you.
Read more ...

Program Raw Atmeg32u4 to Sparkfun Pro Micro 3V/8MHz Bootloader

Jul 30, 2018

Hardware:

FTDI ft232 Breakout board

ft232 board   ATMEGA32u4
3.3V          3.3V
GND           GND
TX            MOSI
CTS           MISO
RX            SCK
DTR           RST_N

All connections are on the end to the breakout board (except 3.3V)

Software:

Reference https://electronut.in/bootloader-atmega32u4/
Avrdude that has the ft232 driver

Addtion to avrdude-serjtag04n "avrdude.conf"
 programmer
  id    = "ftdi";
  desc  = "FT232R BitBang Programmer";
  type  = ft245r;
  miso  = 3; # cts
  sck   = 1; # rxd
  mosi  = 0; # txd
  reset = 4; # dtr
#  baudrate = 4800 ;
;

Sparkfun Pro Micro 3V bootloader
https://github.com/sparkfun/SF32u4_boards/tree/master/sparkfun/avr/bootloaders/caterina/Caterina-promicro8.hex

Put "Caterina-promicro8.hex", "avrdude.conf" and avrdude-serjtag04n's "avrdude.exe" in the same directory.


Output


C:\avrdude-serjtag04n\bin>avrdude -P ft0 -c ftdi -p m32u4 -B 4800  -U lfuse:w:0xff:m  -U hfuse:w:0xd8:m  -U efuse:w:0xce:m
avrdude: BitBang OK
avrdude: pin assign miso 3 sck 1 mosi 0 reset 4
avrdude: drain OK

 ft245r:  bitclk 4800 -> ft baud 2400
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9587
avrdude: reading input file "0xff"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xff:
avrdude: load data lfuse data from input file 0xff:
avrdude: input file 0xff contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0xd8"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xd8:
avrdude: load data hfuse data from input file 0xd8:
avrdude: input file 0xd8 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.02s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xce"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xce:
avrdude: load data efuse data from input file 0xce:
avrdude: input file 0xce contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.02s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified

avrdude: safemode: Fuses OK


avrdude done.  Thank you.


C:\avrdude-serjtag04n\bin>avrdude -P ft0 -c ftdi -p m32u4 -B 4800
avrdude: BitBang OK
avrdude: pin assign miso 3 sck 1 mosi 0 reset 4
avrdude: drain OK

 ft245r:  bitclk 4800 -> ft baud 2400
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587

avrdude: safemode: Fuses OK

avrdude done.  Thank you.


C:\avrdude-serjtag04n\bin>avrdude -P ft0 -c ftdi -p m32u4 -B 4800 -U lfuse:r:low_fuse_val.hex:h -U hfuse:r:high_fuse_val.hex:h
avrdude: BitBang OK
avrdude: pin assign miso 3 sck 1 mosi 0 reset 4
avrdude: drain OK

 ft245r:  bitclk 4800 -> ft baud 2400
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9587
avrdude: reading lfuse memory:

Reading | ################################################## | 100% 0.02s

avrdude: writing output file "low_fuse_val.hex"
avrdude: reading hfuse memory:

Reading | ################################################## | 100% 0.02s

avrdude: writing output file "high_fuse_val.hex"

avrdude: safemode: Fuses OK

avrdude done.  Thank you.


C:\avrdude-serjtag04n\bin>avrdude -P ft0 -c ftdi -p m32u4 -B 4800 -U flash:w:Caterina-promicro8.hex
avrdude: BitBang OK
avrdude: pin assign miso 3 sck 1 mosi 0 reset 4
avrdude: drain OK

 ft245r:  bitclk 4800 -> ft baud 2400
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9587
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
 ft245r:  bitclk 4800 -> ft baud 2400
avrdude: reading input file "Caterina-promicro8.hex"
avrdude: input file Caterina-promicro8.hex auto detected as raw binary
avrdude: writing flash (32768 bytes):

Writing | ################################################## | 100% 217.75s


Final:

Remove SCK, MISO, MOSI and RST_N, Power Cycle and then Plug USB.   The COM should show up in Device  Manager.
Read more ...