Interfacing
Banana Pi + Enc28j60 (SPI Interface)
35
15594
|
[Interfacing]
Banana Pi + Enc28j60 (SPI Interface)
[Copy link]
|
|
It is in the first partition of the SD card. If you use Raspbian OS, it is in the directory of bananapi of the first partition. |
|
|
|
|
|
|
|
Post Last Edited by n3m at 2014-9-11 10:22
Post Last Edited by n3m at 2014-9-11 10:13
Reply 11# tony_zhang
thanks! I found out just now how this works when i was playing around with the allmighty sunxtoolkit 
I will give you a feedback shortly.
Reply 8# sashijoseph
worked! thanks a lot! now I know how to handle the sunx - 
I get the following dmesg output:
- [ 72.879870] [spi-inf] Found 1 spi devices in config files
- [ 72.886660] [spi-inf] boards num modalias max_spd_hz bus_num cs mode
- [ 72.893707] [spi-inf] 0 enc28j60 10000000 0 0 0x0
- [ 72.898748] [spi-inf] sun7i_spi_probe: spi0 dma type: normal
- [ 72.902354] [spi-inf] bus num = 0, spi used = 3
- [ 72.912239] [spi-inf] sun7i_spi_probe: spi0 cs bitmap: 0x3
- [ 72.921471] [spi-inf] sun7i_spi_set_mclk: spi0 source = sdram_pll_p, src_clk = 432000000, mclk 86400000
- [ 72.927789] sun7i-spi sun7i-spi.0: master is unqueued, this is deprecated
- [ 72.936662] [spi-inf] sun7i_spi_probe: reuuimlla's SoC SPI Driver loaded for Bus SPI0 with 2 Slaves at most
- [ 72.946126] [spi-inf] sun7i_spi_probe: spi0 driver probe succeed, base f02f6000, irq 42, dma_id_rx 24, dma_id_tx 24
- [ 72.972853] enc28j60 spi0.0: enc28j60 Ethernet driver 1.01 loaded
- [ 72.982002] net eth1: enc28j60 driver registered
- [ 73.038447] net eth1: link down
- [ 73.041025] net eth1: multicast mode
- [ 73.043633] net eth1: multicast mode
- [ 73.047217] net eth1: multicast mode
Copy the Code setting eth1 up with ifconfig and setting appropriate routes did work as well but there is no connection.
pinging the router results in lost packages. Any suggestions?
setting the frequency higher than 12MHz resulted in failing to load the eth module. Did anybody ever manage to get the native spibus working with 100Mhz? |
|
|
|
|
|
|
|
Reply 12# n3m
N3m have you set the interrupt edge to "falling" ? |
|
|
|
|
|
|
|
Post Last Edited by n3m at 2014-9-12 15:39
Reply 13# sashijoseph
No I did not do that since basic operations should work anyways.
My current setup with 2 enc:
Both adapters get successfully registered:
IRQ wiring : adapter0->GPIO24(pin 18) and adapter1->GPIO25(pin 22)
/proc/interrupt/
- 162: 0 0 gpio-sunxi enc28j60
- 189: 1 0 gpio-sunxi enc28j60
Copy the Code this is my fex:
- [spi_devices]
- spi_dev_num = 2
- [spi_board0]
- modalias = "enc28j60"
- max_speed_hz = 12000000
- bus_num = 0
- chip_select = 0
- mode = 0
- full_duplex = 0
- manual_cs = 0
- irq_gpio = 1
- [spi_board1]
- modalias = "enc28j60"
- max_speed_hz = 12000000
- bus_num = 0
- chip_select = 1
- mode = 0
- full_duplex = 0
- manual_cs = 0
- irq_gpio = 2
- [gpio_para]
- gpio_used = 1
- gpio_num = 2
- gpio_pin_1 = port:PH02<5><default><default><default>
- gpio_pin_2 = port:PI17<5><default><default><default>
Copy the Code dmesg
- [ 37.777933] [spi-inf] Found 2 spi devices in config files
- [ 37.784733] [spi-inf] boards num modalias max_spd_hz bus_num cs mode
- [ 37.791774] [spi-inf] 0 enc28j60 12000000 0 0 0x0
- [ 37.798806] [spi-inf] 1 enc28j60 12000000 0 1 0x0
- [ 37.803786] [spi-inf] sun7i_spi_probe: spi0 dma type: normal
- [ 37.807496] [spi-inf] bus num = 0, spi used = 3
- [ 37.811938] [spi-inf] sun7i_spi_probe: spi0 cs bitmap: 0x3
- [ 37.820636] [spi-inf] sun7i_spi_set_mclk: spi0 source = sdram_pll_p, src_clk = 432000000, mclk 86400000
- [ 37.827418] sun7i-spi sun7i-spi.0: master is unqueued, this is deprecated
- [ 37.836400] [spi-inf] sun7i_spi_probe: reuuimlla's SoC SPI Driver loaded for Bus SPI0 with 2 Slaves at most
- [ 37.845851] [spi-inf] sun7i_spi_probe: spi0 driver probe succeed, base f0364000, irq 42, dma_id_rx 24, dma_id_tx 24
- [ 37.889041] enc28j60 spi0.0: enc28j60 Ethernet driver 1.01 loaded
- [ 37.899424] net eth1: enc28j60 driver registered
- [ 37.904697] enc28j60 spi0.1: enc28j60 Ethernet driver 1.01 loaded
- [ 37.913591] net eth2: enc28j60 driver registered
Copy the Code the problem remains the same for both adapters |
|
|
|
|
|
|
|
n3m,since you have enabled interrupts,I think it would be better to configure the edge as well.
Even a basic TX operation would use the INT pin to signal the host(BPi) that a TX operation has taken place and then the host would clear the interrupt flag and proceed with whatever needs to be done.If the host does not detect an interrupt I don't think it will automatically fall back to polling the particular interrupt flag.
If interrupts were not enabled in the first place then the ENC would probably work with polling.
So please set the interrupt edge in /sys and see if it makes a difference. |
|
|
|
|
|
|
|
IRQ wiring : adapter0->GPIO24(pin 18) and adapter1->GPIO25(pin 22)
gpio_pin_1 = port:PH02<5><default><default><default>
gpio_pin_2 = port:PI17<5><default><default><default>
Seems this is not correct.
Pin 18 would be PH21 and the correct line would be
port:PH21<6><default><default><default>
Pin 22 would be PI16
port:PI16<5><default><default><default> |
|
|
|
|
|
|
|
Post Last Edited by n3m at 2014-9-13 11:29
Reply 15# sashijoseph
"If interrupts were not enabled in the first place then the ENC would probably work with polling.
So please set the interrupt edge in /sys and see if it makes a difference."
I agree. I changed the lines as you suggested, but I cannot set the gpio in /sys/class/gpio/export like I did with the rpi.
Even root may not export anything. "Write error: Invalid argument"
write privileges are given for dir and export itself. |
|
|
|
|
|
|
|
The number to export would be 245 for PH21 and 272 for PI16.
Try and see....
reference : http://sunxi.org/GPIO |
|
|
|
|
|
|
|
in the script.bin I provide in the images, the gpio_para is set to be same with rapspberry Pi. You can just echo 25 > export and echo 24 > export to enable them. And set interrupts |
|
|
|
|
|
|