SuperMicros.org
  • Home
  • BeagleBone Black
    • LCD Display For BBB
  • BBB Blog
    • JTAG Connector Installation video

BeagleBone Black Blog

This is my blog about what I have discovered about the BeagleBone Black.

SYSBIOS on the BeagleBone Black?

7/29/2013

2 Comments

 
In my final project that requires the fast GPIO use, I will also be needing access to the ethernet connection on the BeagleBone Black. Since I am not an expert on ethernet stuff, I am investigating Texas Instruments' SYSBIOS. SYSBIOS is similar to a "Real Time Operating System", or RTOS. It lets you add any modules that you need from a wide variety "standard modules. It also lets you prioritize tasks so that time dependent hardware interrupts can take priority over other tasks. In my preliminary tests, I have loaded some demo SYSBIOS projects, compiled them and run them on the BeagleBone Black. The debugging seems to run just fine on the BeagleBone Black. Like any large program with multiple operations, SYSBIOS has a steep learning curve in order to really become proficient with it.

By reading the descriptions of SYSBIOS, it looks like it will do what I need to do. The best part is that Texas Instruments offers SYSBIOS free. In fact it comes installed with the latest version of Code Composer Studio. According to the Texas Instruments website, Code Composer Studio is not necessary in order to be able to compile SYSBIOS. There are some instructions that I found on the Texas Instruments website that tell how to compile SYSBIOS on GNU compilers. That's about all I have to report for now. I will post more as I get into it a little deeper.
2 Comments

BeagleBone Black "Bare Metal" Programming

7/23/2013

5 Comments

 
After receiving my JTAG emulator, I did some preliminary testing of the GPIO maximum toggle speed (the time it takes to change from a high to a low).  When running through the Linux kernel, I was getting a maximum rate of around 8 KHz. or less. With direct access to the GPIO registers, I am able to get a maximum rate of just a little over 1.5 MHz.  I am also able to write all the bits at one time instead of one bit at a time. This results in virtually NO delay between each bit. SO... it looks like I will be able to meet my requirements by using "bare metal" programming.
5 Comments

JTAG and Emulation on the BeagleBone Black

7/17/2013

84 Comments

 
With any down and dirty "bare metal" programming, it is best to have an emulator to connect to a JTAG port so that you are able to download your programs and single step through them where you can examine the registers and variable values. The Beaglebone Black has a place for a JTAG connector, but it does not come with a connector installed. The connector is a very small 20 pin connector with pin 6 missing to use as a key so that the mating connector cannot be installed wrong. The connector required is a Samtec part number FTR-110-03-G-06 (20 pin male connector, surface mount).

With a very small tip on a  low wattage soldering iron, it can be installed. There is solder already on the mounting pads on the board, so if you pre tin the bottom of the connector pins with solder before installing, the process will go more smoothly (you just need a thin film of solder). Be careful, since the connector can be installed wrong. If you look at the BeagleBone Black manual, near the end, it shows the silkscreen image of both sides of the board. The bottom side shows the JTAG connector pads with the pin numbers beside them. Make sure the missing pin 6 is over the pin 6 position on the board. Just a touch of the soldering iron on each pin should be enough to melt the solder on the board and make a good connection. Using more solder makes shorting (bridging) between pins likely. Examine all the connections with a magnifier to make sure they are all well connected with solder.

Next, I ordered an XDS100V2 USB emulator from Texas Instruments. CAUTION: there are several different versions of XDS100 emulators. There are XDS100V1, XDS100V2, and XDS100V3 emulators. These different types also have different connectors for different processors. The one I needed to connect to the BeagleBone Black is the XDS100V2 with a 20 pin connector. After the emulator arrived, I connected it up and tried to run a minimal main.c program that only initialized a few variable, nothing else. Much to my dismay, the emulator reported that the processor was being held in reset and would not connect. I knew that the processor was NOT in reset as it was running the internal Angstrom Linux and the user LEDs were flashing.  Just to be sure, I checked the  SYS_RESET (pin 15 on the JTAG) connector. It was at 3.3 volts, indicating that the board was, in fact NOT in reset. I also noticed that the TRSTn (pin 2) was always low. It looked like the emulator was monitoring this pin for reset. It looked like everything was connected up correctly, but still didn't work.

After a little more investigation, I found that you needed to hold down the Boot Switch on power up so that the beagleBone does not try to boot Angstrom Linux. I also found that the ARM processors have to have some registers specifically preset in order to work with a JTAG device. This is done by downloading a .gel file first to initialize the processor correctly. I found a .gel file that was supposed to work with a BeagleBone Black, and set up Code Composer Studio to download this file upon connect. Much to my surprise and delight, the DEBUG version of my program started downloading. After a short delay,  my main.c program was displayed with a break point at the very beginning of my main.c program. As I single stepped through the main program, I was able to examine the variables and verify that they were being initialized just as I had programmed them to be. GREAT, now I am off to do some "real" programming ("bare metal") down in the guts of the processor.
84 Comments

BeagleBone Black GPIO Musings

7/11/2013

11 Comments

 

After I had written the mandatory "Hello World" program in C, and running it on the BeagleBone Black, I decided to play around with some GPIO ports to see if they were capable of doing what I wanted to do. I wanted to be capableable of switching several ports (8 total) at around a 250 KHz rate, so that I could create a parallel interface for a device that I was planning. After reading up on GPIO programming in C on the BeagleBone, it began to look like what I needed to do was not possible while running the Linux operating system. One of the problems was that the suggested method to operate the GPIO ports in Linux is by writing to the ports using a file system to open a file for each pin, and then fprinting a 1 value to one location to set the port high, closing the file, then fprinting a 1 to another location to set the port low (clear) and then closing that file, seemed to be VERY SLOW. I started out using a single GPIO pin and setting it high and low in an infinite loop to see just how fast this could be done using the suggested method in the Linux kernel.

I was very disappointed to find that the fastest I was able to switch with this method was around 8 KHz. (very much slower than the 250 KHz. target I wanted). Also the timing would be the same for a few cycles, then have a longer cycle and then the same again (I assumed that the Linux kernel was doing something during this time and delayed the GPIO switching for a period).  Next, since I needed to be able to switch 8 pins at the same time, I wanted to know how much delay would be involved between the writing of one pin and the next (the maximum I would be able to tolerate with my intended plans would be on the order of 1 microsecond or less). I re-wrote the program so that I would write 1 GPIO pin high, immediately followed by writing another GPIO pin high, then immediately writing the first pin low, followed by writing the Second pin low in an infinite loop.

The results disappointed me even more. By just increasing from using 1 pin to two, the frequency decreased from around 8 KHz. to around 4 KHz. Extrapolating that to eight pins would lead to a frequency of probably less than 50 Hz. total (WAY TOO SLOW). The other thing that was unacceptable was the delay between writing to each pin. You can see from the logic analyzer picture below that the difference between the time the first GPIO is set high (marker T1) and the time the second GPIO is set high (marker T2) is 62.375 microseconds. This value WAY exceeded my tolerance of around 1 microsecond. From these tests I have concluded that I am not going to be able to use Linux to do what I need to do. There is a register on the ARM processor that lets you write highs and lows to GPIO pins all at the same time, but I was not able to find a way to do this using Linux. SO... I have decided to use my own program to access the hardware in the ARM processor directly. That means writing a lot of C code and probably also writing some libraries. I am currently awaiting the arrival of some Samtec connectors so that I can install a JTAG connector on my BeagleBone. After that I will be able to load and debug C code directly on the BeagleBone without booting the Linux Kernel. That's all for now.

 
Picture
11 Comments

    About   Dean Davis

    After working in electronics design for almost 41 years, and some of the last few years of that doing embedded microprocessor programming and design, I have again gotten the bug to do some playing around with microprocessors.

    Archives

    July 2013

    Categories

    All

Copyright supermicros.org 2013