Last modified 2017-09-25 00:25:11 CDT

JuiceBox Homebrew

2006/01/19 - More JuiceBox Dev

The JuiceBox is a great dev board to learn on. Everything is production prewired, all you have to do is write the code to work it…

Today I have made some significant progress with the general understanding of this embedded hardware. Using just JTAG/OCDCommander, the datasheet, and the register definitions in s3c44b0x.h, I have gotten two different parts of the board to work. First, the buttons. This was pretty easy, since I have worked with the idea of setting the direction of a port and manipulating the port in the past.

The buttons of the juicebox are located on port G, so two primary registers are involved: PCONG and PDATG. The first one being the direction of the port (16-bit register, 2 bits per pin to be: input, output, special), and the second one being the data representing that port (8-bit). Instead of fumbling with the math and finding the bitwise masks required to push certain buttons, I simply read the PDATG back in OCDCommander with different buttons pressed at different times, and then defined these values in my own code to be easily accessible and easily compared to PDATG. I get this in the end:

#define JB_PLAY 0×9D
#define JB_RETURN 0×9E
#define JB_STAR 0×8F
#define JB_FORWARD 0×9B
#define JB_REVERSE 0×97
#define JB_ATREST 0×9F

To use the port G, I first set the direction of the whole port to input (pcong = 0×0000;), and then the data on port G can be directly compared to these constants. It works great.

JB Button Test Source Code (prints out in the LCD what button you have pressed), precompiled elf included as well:

2006/01/16 - JuiceBox Game of Life

After writing the game itself for the first time on my computer, I proceeded to clean up some of the LCD Demo Code and then port the Game of Life to the JuiceBox. It uses the whole screen as the grid of cells, and each individual pixel as a cell. The initial grid is randomly generated (although not really random at all, it uses the very psuedo-rand() included in the LCD demo code), and then the generations pass by forever, with 5 milliseconds rest in between. Each pixel changes color (any color but black) when it is replotted, just to make them look cool.

Since births and deaths simultaneously occur in the Game of Life, you can’t modify a grid directly when applying the three rules of the game. Originally I kept a temporary copy grid that would be checked, while the original would be modified. But, due to memory limitations on the JuiceBox itself, I had to rewrite the grids to use a more complex “marked for death/birth” status in the cells. Anyway, it runs perfectly, and it’s pretty cool to watch.

Here is a picture of a sample game, near the beginning:


Here is it towards the end, when it is rather stable:


If you want to try it for yourself, here is the elf file that can be downloaded with OCD Commander or similar program to your JuiceBox (given you have a JTAG emulator as well): JB_GameOfLife.elf

The sources for JuiceBox Game of Life can be found here: N/A

I take absolutely no responsibility for any damage this software may cause.

Next project is learning to use those buttons and I/O ports on this ARM chip.

2006/01/16 - Custom Code via JTAG on JuiceBox Success

Shortly after I got my JTAG Wiggler working with the JuiceBox, I hunted out some homebrew code precompiled for the JuiceBox. I found it here:

Using OCD Commander you can easily upload the code to the processor’s memory through a JTAG emulator, and it will automatically set the PC register to the start of the program. All you have to do is hit go, and your program is running.

I played with the LCD demos, and modified the second one to print a greeting message, which I took a picture of to post here:


My next familiarization project is to port, for the first time ever (hehe), the game of life to the JuiceBox. I will have pictures of this tomorrow when the project is complete. It shouldn’t be too difficult, since the LCD demo code has shows how to drive the LCD and plot pixels.

In addition, I want to mess with the buttons. They are located on PORTG, but I still have yet to learn how I am supposed to properly manipulate the PORT registers on this ARM chip…

I love JTAG and $15 ARM development boards.

2006/01/15 - JTAGing JuiceBox Success

After realizing where I messed up in building my Wiggler JTAG dongle, I fixed the small problems and connected it back to the computer. I ran jtag (from openwince project) and detect’d the Wiggler… it worked flawlessly. Here was the output:

jtag> cable parallel 0×378 WIGGLER
Initializing Macraigor Wiggler JTAG Cable on parallel port at 0×378
jtag> detect
IR length: 4
Chain length: 1
Device Id: 00011111000011110000111100001111
Manufacturer: Samsung
Part: s3c44b0x
Stepping: 0
Filename: /usr/local/share/jtag/samsung/s3c44b0x/s3c44b0x

In addition, I ran ocdremote, which recognized the Wiggler, connected to it immediately, and setup the local TCP server for GDB to connect to. I ran the arm-elf-insight (Insight is a standalone frontend to GDB) that is packaged with the GNUARM toolchain, and connected to OCDRemote. After the connection I could view all of the juicebox’s CPU registers and internal RAM. I could also step through the program instructions.

Now I’m compiling jtager over cygwin so I can dump the internal RAM of the CPU and compare some of it to the chunks that are posted on the linuxhacker forums…

Soon I’ll write a tutorial for integrating OCDRemote with GDB with Code::Blocks, so people can easily develop and debug all ARM7 projects through Code::Blocks. Finally, I can uninstall eclipse.

2006/01/14 - Update on JuiceBox Dev

After frying my last juicebox (long story), I bought another one off ebay and it recently arrived. Finally I have had some time to get it up to speed (open it up, solder the sd/mmc lines, solder the UART lines). It is working great, and for the first time I am seeing the kernel boot messages, which I have posted here. Read on to see pictures and more information.

Here is a picture of my current setup:


On the breadboard is the sparkfun sd/mmc breakout board, my own custom max232 board (this one rigged with a max3232 since juicebox operates at 3.3v). Since I’m currently stuck with a laptop that doesn’t have a serial port, I’m using a cheap serial-USB converter which apparently works fine with the juicebox UART/max3232.

Here is a picture of the wiring on the back of the juicebox board:


Here are the captured kernel messages, captured from in HyperTerminal:

Linux version 2.4.24-uc0 (msiu@martin) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from XIP and shared lib patches from #118 Mon Aug 23 10:29:57 HKT 2004
Processor: Samsung S3C44B0X revision 0
Architecture: S3C44B0X
On node 0 totalpages: 497
zone(0): 0 pages.
zone(1): 497 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/rom0
Calibrating delay loop... 29.90 BogoMIPS
Memory: 1MB = 1MB total
Memory: 1108KB available (523K code, 285K data, 36K init)
Dentry cache hash table entries: 512 (order: 0, 4096 bytes)
Inode cache hash table entries: 512 (order: 0, 4096 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 1024 (order: 0, 4096 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
Samsung S3C44B0X UART driver version 0.1 <>
ttyS0 (irq = 3) is a builtin Samsung S3C44B0X UART
UART Rx disabled for production release
Samsung s3c44b0x 4096 color STN driver frame buffer: 0x0C1F1F00
Cirrus Logic CS43L43 Stereo DAC with Headphone Amp
Function keys for Toymaker video player
Power Management for Toymaker video player
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk images:
0: 6A1000-8A0FFF [VIRTUAL 6A1000-8A0FFF] (RO)
SD/MMC SPI driver for s3c44b0x
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
FAT: bogus logical sector size 14432
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 28K
Welcome to
          ____ _  _
         /  __| ||_|                 
    _   _| |  | | _ ____  _   _  _  _ 
   | | | | |  | || |  _ \| | | |\ \/ /
   | |_| | |__| || | | | | |_| |/    \
   |  ___\____|_||_|_| |_|\____|\_/\_/
   | |

For further information check:

NANOX: clearscreen disabled
NANOX: rootwp no background
# NANOX: blank screen disabled
BUILD 040813194807
[14]main: audio mode
[14]backlight timeout=30
open /dev/audio
open audio device success
emplayer_play_media_file: play /home/juicebox.mp3
decode thread pid: 17

OK Estimate from BIT RATE .................n

audio thread pid: 18
dec thrd: eof reached
dec thrd: before last while 
b4 decode thread join
BUG HIT: audioq.size 0 unchanged for 1 times
dec thrd: closing a stream 
Leaving audio thrd

For more information on JuiceBox dev, see the eLinux Wiki page on it here: Also check out the JuiceBox section on the Linux-Hacker forum:

Creative Commons License