Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: tomio64 on December 02, 2015, 10:23:19 am

Title: Spi , kernel linux, mcp23s17
Post by: tomio64 on December 02, 2015, 10:23:19 am
Hello,
I want use spi port for drive expander port mcp23s17,
so, i want use interrupt capablities of mcp23s17,
can you say if actual version of linux kernel and drivers for mcp23s17 of oluxino lime2, is able to use interupt?
And have you sample example in c for establish comunication with mcp23s17 ?
thank you
best regards
Title: Re: Spi , kernel linux, mcp23s17
Post by: deskwizard on December 03, 2015, 04:28:47 am
I know I have seen drivers for either the MCP23S17 or the MCP23017 in the kernel configs for 3.4.39 (standard kernel from allwinner).

As for the interrupt part, that one I can't tell, but I have a olinuxino-a20-micro and both models of MCP, so if you need any help with that, I should be able to help.

I'd suggest to get the MCP working before playing with interrupts as those can be very touchy on those chips.

Let us know our findings!

DW
Title: Re: Spi , kernel linux, mcp23s17
Post by: tomio64 on December 03, 2015, 11:01:04 am
Hello,
thank you for your help is very kind !

So i have olimex lime2 with 4gb nand.
My problem, is have the maximum input with irq, the number of gpio with irq usable in olimex card is not enought, for my project!

The other problem is very small connector, not practical for project!

So the spi can drive 8 chip mcp 23s17.
I can have 128 io by spi.

In my project, i want receive information of irq when one of 128 io have the state changed, and after my treatement, i send udp or tcp message.

I write the code in c on linux and my soft run like deamon on linux.

In fact is like gpio relay to ethernet to other computer !

The thing that i known:
Write c code and compile with gcc .

The udp part of code is write and work on linux like deamon.

I known calculate an build electronic and pcb.

I don't known how i can communicate in spi to mcp23s17

So have you small sample code, in c than explain how use mcp23s17
in input and in ouput for test.

i can, build electronic sample, and  connect button and led for understand mechanism of communication ?

thank you for your help
Best regards
Patrice