Monday, February 11, 2008

preparation of I/O

In anticipation of the brand new PCB that is going to take care of 40 inputs and 40 outputs I did already some useful research. It will be necessary to have not only the related i2c signals available but also some i/o pins which are going to deal with interrupts and output enabling. Therefore I must have 4 signals connected to the gpio of the ngw. To be able to do this kind of signal capturing there are 2 possibilities:
  1. Writing a kernel module
  2. Userspace access via configfs
I preferred the user space to take. This has the advantage of having everything central and easy to debug if necessary. It took some time to finger it out how the configfs was working but finally it became clear. I wrote a little start up script to add the files under the appropriate directory. I took a c example of the avr freaks site and compiled it in the avr studio. This example showed the different approaches you can have when working with gpio as a character device. So it was excellent to start with. I set things up to work with the dedicated PA pins also needed for my new i/o board. I tested the 4 lines in having 0/1 and all state changes popped up very well on my screen. I was bit scared tough because the 4 pins where located on the same port as i2c. But I ran the led program together with the i/o program for 12 hours and things didn't interfere at all ! This was good news because the proof of concept now is almost complete.
This week I expect some good linux books. They will be used to get a more in-depth view on programming applications using the unix framework/kernel like signals , threads ,... I will have some blogs on them later on to review a few chapters. Now I can start thinking of the program structure I will use to write domotic program.

So always preparing for next steps in small well-aligned pieces is the way I like to make progress in complex systems.

No comments: