Interfacing

Banana Pi + Enc28j60 (SPI Interface)

35 11926
n3m  
Hi!
I am trying to get an ENC28j60 running with the BananaPi.

Interface -> GPIO:
  1. VCC -> 3,3v
  2. GND -> GND
  3. CS -> CE0
  4. SI -> MOSI
  5. SCK -> SCKL
  6. SO -> MISO
  7. 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.
  1. 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.
  1. echo "25" > /sys/class/gpio/export;echo "falling" > /sys/class/gpio25/edge;echo "25" > /sys/class/gpio/unexport
  2. 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?

n3m  
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:

  1. 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.

n3m  
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...
  1. [spi_devices]
  2. spi_dev_num = 1

  3. [spi_board0]
  4. modalias = "enc28j60"
  5. max_speed_hz = 10000000
  6. bus_num = 0
  7. chip_select = 0
  8. mode = 0
  9. full_duplex = 0
  10. manual_cs = 0
  11. irq_gpio = 1

  12. [gpio_para]
  13. gpio_used = 1
  14. gpio_num = 1
  15. 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

n3m  
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:
  1. git clone https://github.com/mspecl/spi-config
  2. cd spi-config
  3. make && make install && depmod
Copy the Code

You have to log in before you can reply Login | Sign Up

Points Rules