Sunspot Home. . . . . . Joggler menu

Connect to the i2c bus on the Joggler main board

Create push button inputs, light external LED's, measure analog voltages,
run an LCD panel, control a servo motor, control the world . . . .

Use standard i2c chips or connect to a PIC16F877A programmed as i2c slave.

The clue to finding the bus was the ICS UMS9001 clock chip U13 - see the chip manifest (thanks)
Pin 5 is SDA (data) and pin 6 is SCL (clock)


There are 2 via's but they are too small for my soldering skills!


So they must also be on the 8051 type processor the SILABS F311 which is U35 (connected to the light sensor)
- the multi meter finds connections here


And on the back of the board behind the F311 there is just enough room to solder 2 wires
- I chose coil winding wire thin enough to enter the via ( a good anchor for the solder)
Then I used hot glue to hold the wires in place.
SCL is a bigger pad under the figure "8" of "R408". SDA is next to it.


On the far left of the board there is a copper antenna with no driver chips populated (for Bluetooth?)
I hacked this to make pads to connect the thin wires to a ribbon cable that leaves the Joggler via a hole drilled in the back.

I was unsure where to take the 3.3 Volts from and could not find a large pad to solder to.
Tell me if you locate one!
I will generate 3.3 V from the 5 V that I need for the level changer.

Earth was taken from the remains of the Bluetooth (?) antenna

Looking at the end of my ribbon cable - it seems we have a clock and some data when I enter
i2cdetect 0


So the clock frequency is about 87 KHz

I plan to build a level changer, an i2c long line driver and add a PIC for general purpose I/O, AtoD, model servo driver etc

- more later

- email me here
if you find out more

A 3.3V to 5V i2c level converter MUST BE USED : -

i2c converter
This was for my Sweex box
- I will change this for a full circuit of my PIC "breakout box" when finished

 PCF8574 (8 line general purpose I/O) - WORKING!

i2cdetect 0 shows that my chip is at address 0x27 (decimal 39)
I send
i2cset -y 0 0x27 0x0 0x01 b

i.e. on i2c bus 0 at address 0x27 at the first register (there is in fact only one)
send a byte 00000001 and so set the line zero of the 8 I/O lines to high
-y "means do not ask for confirmation", b means "use binary mode"

See the man page here

I see that 0x4c is used in the Joggler
- the PCF8591P AtoD chip on my i2c test board also uses that - change then test

To read the 8 lines on a PCF8574
i2cset -y 0 0x27 0x0 0xFF b - to make all lines high as they must be before a read
- set the line states from the external devices - then -
i2cget -y 0 39 - this prints the result (note it is happy to use either decimal 39 or the equivalent hex 0x27)

Drive an external PIC16F877A using just i2cset and i2cdetect on the Joggler - a test example

The PIC has an array buffer[0x10] and i2cset can load values into it by sending the array element number followed by the value
The circuit is like the left hand circuit at the bottom of this page

e.g. i2cset -y 0 80 0 2 b sends to i2c bus 0 at address decimal 80 and places a value 2 in the array element buffer[0]
In this test pin DO is wired to an LED (then to resistor to ground - so LED on = high )

buffer[0] . . . Set the mode of action. If it is 1 then the LED flashes and if it is 0 the LED is on or off
buffer[1] . . . For the flashing mode 200 means set pin D0 high for 200 milliseconds
buffer[2] . . . For the flashing mode 200 means set pin D0 low for 200 milliseconds
buffer[3] . . . For the on or off mode, 1 means ON, 0 means OFF

CCS-C code for the PIC

#include <16F877.h>
#use delay(clock=20000000)
#use i2c(SLAVE, SDA=PIN_C4, SCL=PIN_C3, address=0xA0, FORCE_HW) // I2C by Hardware

// defined address 0xA0 becomes 0x50 (decimal 80) in "i2cdetect 0" display
// - linux puts a 0 before the address and removes one at the end
BYTE incoming, state; // I2C variables
BYTE address ; // sets which element of the buffer[] array is written to or read
INT16 buffer[0x10]; //Array of Int16s

//-------------------------------------------------------i2c interupt routine
void ssp_interupt ()
state = i2c_isr_state();

if(state < 0x80) //Master is sending data
if(state == 1) //First received byte is buffer[] array element number
incoming = i2c_read();
address = incoming;

if(state == 2) //Save second received byte in location buffer[address]
incoming = i2c_read();
buffer[address] = incoming;
if(state == 0x80)
//This runs if Joggler is requesting data
//use "i2cget -y 0 80 <address>" to print value of buffer[address]
i2c_write (buffer[address]);
void main()
delay_ms(200); // power up delay
set_tris_D ( 0b11111111 ); // Port D 11111111

//---------------------------------------------------------set startup state

buffer[0] = 1; //----MODE 1 --continuous pulses on D0
buffer[1] = 200; //--------length of high section
buffer[2] = 200; //--------length of low section
buffer[3] = 1; //----set pin D0 high when "i2cset -y 0 80 0 2 b" sent--MODE 2



//-----MODE 1-------continuous pulses on pin D0 if "i2cset -y 0 80 0 1 b"
if (buffer[0] == 1)

//------MODE 2-----------set pin D0 high or low if "i2cset -y 0 80 0 2 b"
if (buffer[0] == 2)
if (buffer[3] == 1) //---if "i2cset -y 0 80 3 1 b" is sent

if (buffer[3] == 0) //---if "i2cset -y 0 80 3 0 b" is sent

} while(TRUE);//------------keep looping this do section


I would like to fill the buffer array all in one stream of data but my c programs that do that for the NSLU2/Slug
SWEEX and Bifferboard compile in the Joggler and seem to run but there is no i2c bus activity as seen on a 'scope

Sunspot Home . . . . . . . Joggler menu