Hardware Reference
In-Depth Information
Combining the BBB with an ATmega328p
Lastly, the CryptoCape contains an independent microcontroller. This microcontroller is the
ATmega328p , which is the same microcontroller on the Arduino UNO. However, because
the supply voltage is 3.3V and not 5V like the Arduino UNO, the processor runs at a clock
speed of 8MHz versus 16Mhz. In this sense, it is more like the 3.3V Arduino Pro Mini.
Shipped from SparkFun, the CryptoCape contains the 3.3V Arduino Pro Mini bootloader.
Like any other Arduino-based board, you can reflash the bootloader by attaching an In-
System Programming ( ISP ) programmer to the ISP headers next to the ATmega328p.
SparkFun's pocket programmer is an inexpensive tool to perform this task. Just be sure to
set the switch to no power target since the CryptoCape is powered from the BBB.
While you can use an ISP programmer, you can also use the BBB as a programmer. The
BBB contains both serial UART and SPI; however, only the serial UART, UART 4, is con-
nected to the onboard ATmega328p. Like the Arduino UNO, if the microprocessor is reset,
it will accept uploaded programs over the serial line.
A simple script that toggles the BBB GPIO connected to ATmega's reset line, which is
GPIO 49 for the CryptoCape, and then uploads the hex file using avrdude will do the
trick. The script is part of a GitHub repository which can be cloned with the command:
git clone https://github.com/jbdatko/
In this repository, there is an upload.sh script, the main logic of which contains the fol-
lowing code snippet:
(echo 0 > /sys/class/gpio/gpio49/value \
&& sleep $tts \
&& echo 1 > \
/sys/class/gpio/gpio49/value) &
avrdude -c arduino -p m328p -b 57600 -v \
-P /dev/ttyO4 -U flash:w:$1
The first part toggles the ATmega reset line low and sleeps for $tts , which is currently
defined to be .9 seconds. Then the script sets the reset line back to high to let the ATmega
Search WWH ::

Custom Search