Interfacing
Banana Pi + Enc28j60 (SPI Interface)
35
15591
View: 15591|Reply: 35
|
[Interfacing]
Banana Pi + Enc28j60 (SPI Interface)
[Copy link]
|
|
Hi!
I am trying to get an ENC28j60 running with the BananaPi.
Interface -> GPIO:- VCC -> 3,3v
- GND -> GND
- CS -> CE0
- SI -> MOSI
- SCK -> SCKL
- SO -> MISO
- INT -> GPIO25
Copy the Code I tested it with a kernel compiled spi_sun7i as module and within kernel. Both did not work when i enabled the module for enc28j60.- modprobe spi_sun7i;modprobe spidev;modprobe enc28j60
Copy the Code I got this module running with a standard rpi by modifying the bmc2708 sources to properly identify the interrupt for this module.
Loading the enc28j60 module resulted in a slow(10mbit) but working ifdevice eth1
Unfortunately I did not find any option @sources to configure static devices with the sun7i... the interrupt won't get recognized even if I use spi-config to load the module for enc28j60. Before I needed to configure the falling edge for the interrupt of this spi device.- echo "25" > /sys/class/gpio/export;echo "falling" > /sys/class/gpio25/edge;echo "25" > /sys/class/gpio/unexport
- modprobe spi-config devices=bus=0:cs=0:modalias=enc28j60:speed=100000000:gpioirq=25
Copy the Code Any suggestions how I make this module work for sun7i ?  |
|
|
|
|
|
|
|
I don't understand clearly what you mean. Did you mean you want to change the clk frequency of spi? |
|
|
|
|
|
|
|
Post Last Edited by n3m at 2014-9-9 20:49
I just want a working additional eth device. The module gets loaded successfully but there is will not a eth device be created. |
|
|
|
|
|
|
|
Reply 3# n3m
But this part code is for what:
- echo "25" > /sys/class/gpio/export;echo "falling" > /sys/class/gpio25/edge;echo "25" > /sys/class/gpio/unexportmodprobe spi-config devices=bus=0:cs=0:modalias=enc28j60:speed=100000000:gpioirq=25
Copy the Code |
|
|
|
|
|
|
|
Tony,I think it is to setup GPIO25(CON3 pin22 ???) as an external interrupt pin.This would be used by the ENC chip for some signalling stuff.
So I think it boils down to how to configure the particular GPIO pin as an external interrupt pin triggered by a falling edge.
Is this correct n3m? |
|
|
|
|
|
|
|
echo "falling" > /sys/class/gpio25/edge;
This just configure the pin to the external interrupt function. You also need input a interrupt to active it.
You follow this line echo "25" > /sys/class/gpio/unexport . I do not no the reason why you disable it again. |
|
|
|
|
|
|
|
Post Last Edited by n3m at 2014-9-10 05:41
Post Last Edited by n3m at 2014-9-10 05:39
@sashjoseph correct.
@tony well this is working with a standard pi to get the enc up and running with 10MHz.
Bananapi will not recognize the enc if the module is loaded - this is the main problem here.
How can I get the ENC working with the sun7i? |
|
|
|
|
|
|
|
Post Last Edited by sashijoseph at 2014-9-10 23:07
Well with RPi you were using the spi-config module to pass spi information to the enc28j60.
Unfortunately spi-config is not available on the BPi.
So you must configure it in the fex file.
Edit the Fex file to reflect these changes...- [spi_devices]
- spi_dev_num = 1
- [spi_board0]
- modalias = "enc28j60"
- max_speed_hz = 10000000
- bus_num = 0
- chip_select = 0
- mode = 0
- full_duplex = 0
- manual_cs = 0
- irq_gpio = 1
-
- [gpio_para]
- gpio_used = 1
- gpio_num = 1
- gpio_pin_1 = port:PI16<5><default><default><default>
Copy the Code Also remove the [spi_board1] section and it's contents.
Now try modprobing the ENC module and check dmesg for any errors etc |
|
|
|
|
|
|
|
Post Last Edited by julie20082004 at 2014-9-11 02:27
Reply 1# n3m
pin 25 is connet to GND |
|
|
|
|
|
|
|
Post Last Edited by n3m at 2014-9-11 09:09
Post Last Edited by n3m at 2014-9-11 04:43
Reply 9# julie20082004
well I am using pin 22 for irq this equals GPIO25 see 
Reply 8# sashijoseph
I were not able to locate the .fex file you were writing about. Where is it located?
If you want to install spi-config @ a bpi:- git clone https://github.com/mspecl/spi-config
- cd spi-config
- make && make install && depmod
Copy the Code |
|
|
|
|
|
|