Archive for JuiceBox

More JuiceBox Dev

I’m not entirely new to microcontrollers, although I’ve never been around the ARM ones. Most of my experience comes from the Atmel AVR line of microcontrollers, but I still consider myself a noob.

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.

Since this worked out of the box so well, I decided to write my own UART interface. I am familiar with UART in general (used it a lot in the AVRs), so I have a basic understanding of how it works. The init() and putc() of my UART interface also surprisingly worked out of the box, but the getc() still needs a bit of work (it half works). When I’m done, I’ll post the UART interface code.

JB Button Test Source Code (prints out in the LCD what button you have pressed), precompiled elf included as well:
http://www.frozeneskimo.com/electronics/wp-content/uploads/Software/JBButtons.zip
Note: I take absolutely no responsibility for any damage this software may cause.

Comments

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:
JuiceBox Game of Life, Towards the End

Here is it towards the end, when it is rather stable:
JuiceBox Game of Life, Towards the End Thumb

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): gol.elf
I take absolutely no responsibility for any damage this software may cause.
I will post the sources shortly…

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

Comments

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: http://www.elinux.org/wiki/JuiceBoxCodeTest

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:
Custom Code Upload onto JuiceBox via JTAG Thumb

My next familiarization project is to port, for the first time ever, 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.

Comments

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
jtag>

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.

Comments

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.

__(’Read the rest of this entry »’)

Comments