Testing the GPIO API

As seen in the previous post, the current GPIO API can perform digital I/O on the Raspberry Pi and can setup a JTAG interface. To see these features in action, two test cases were made available: LIBGPIO_TEST and LIBGPIO_JTAG.

LIBGPIO_TEST

This test can be found at

https://github.com/asuol/rtems/blob/GPIO_API/testsuites/samples/LIBGPIO_TEST/init.c

and assumes the following configuration of the Raspberry Pi GPIO pin header:

Digital I/O test circuit.

The test case initializes the GPIO API, and sets GPIO 2 pin as a digital input (using the internal pull up resistor) and GPIO 3 pin as a digital output. The GPIO 3 pin is sent a logical 0 (so the LED starts turned off), and then the Raspberry Pi polls forever the GPIO 2 pin for a button press. Because the internal pull up resistor is enabled, when the button in not being pressed the GPIO 2 pin value, or level, is 1, and when the button is pressed the pin level is 0. The test case reads the GPIO 2 pin level, and when the level is 0 it sets GPIO 3 pin, so the LED lits up, otherwhise GPIO 3 pin is cleared (and the LED is off).

LIBGPIO_JTAG

This test can be found at

https://github.com/asuol/rtems/blob/GPIO_API/testsuites/samples/LIBGPIO_JTAG/init.c

and it just setups the Raspberry PI GPIO header for JTAG.

The Raspberry Pi GPIO header wiring setup and host computer setup to use the JTAG interface have been described by Alan Cudmore at https://github.com/alanc98/rpi-minimod.

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s