Close

Putting it Together

A project log for OURTicket

Open, Universal, Reliable Transport Ticketing.

BleckyBlecky 08/15/2014 at 15:590 Comments

If you recall, I was going to run into issues with the Explore NFC board since it utilised the same pins as the I2C bus. 

Well after claiming I solved it, it was worth testing things to see if they would still work as planned.

I connected the board up without connecting GPIO2 (GPIO0/SDA) and all the other pins. 

An additional change is required in NXP's source code. In NxpRdLib_PublicRelease/comps/phbalReg/src/R_Pi_spi/phbalReg_R_Pi_spi.c you will need to change:

if (boardRev == 1)
{
    ifsel_fd = open("/sys/class/gpio/gpio0/direction",O_WRONLY);
}
else
{
    ifsel_fd = open("/sys/class/gpio/gpio2/direction",O_WRONLY);
}

To: 

ifsel_fd = open("/sys/class/gpio/gpio8/direction",O_WRONLY);

Obviously this would be different if you decided to use I2C for this, so this change is purely for the SPI implementation.

Fire up the test code and run the polling software:

pi@ourticket-a ~ $ sudo python ledtest.py &
[1] 2262
pi@ourticket-a ~ $ sudo python fram.py
[0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
pi@ourticket-a ~ $ sudo python concept.py
Getting location from GPSD.
Stored transaction in local queue: ##############*20140814-042212*1*ourticket-a*-37.814107*144.96328*B222E7*B606*1toVRqEzEpNhaTBmi8kqqw==
Touch on complete.

Everything should continue to work without hanging or acting erratically (without the NXP source change change, the LEDs will stop). Note, that I won't be performing I2C transactions independently like above, they will be handled one after the other at appropriate times, but for this demo it still works.

Discussions