SPI not working after upgrade to ubuntu 18.04 with patched kernel from ppa

tdudztdudz New Member Posts: 8

Previously, I had ubuntu 16.04 with a patched 4.4 kernel and my code ran fine on the UP board, data being sent over SPI worked well.

I now upgraded to 18.04 and installed the patched kernel from the ppa and enabled spidev2.1 as a kernel boot param. I'm able to see /dev/spidev2.0 and /dev/spidev2.1, but when i run my code to communicate over SPI, i dont get any data back at all even though it succeeds in opening SPI.

What is the correct way to use SPI now? Did something change that I missed?

Comments

  • rreignierrreignier New Member Posts: 52 ✭✭

    I was able to use SPI on Ubuntu 18.04 with upboard kernel 4.15 from ppa.
    But I have used it from a kernel driver (mcp2515) and not spidev.

  • tdudztdudz New Member Posts: 8

    @rreignier said:
    I was able to use SPI on Ubuntu 18.04 with upboard kernel 4.15 from ppa.
    But I have used it from a kernel driver (mcp2515) and not spidev.

    can you share more information about using the mcp2515 kernel driver? thx

  • rreignierrreignier New Member Posts: 52 ✭✭

    @tdudz said:
    can you share more information about using the mcp2515 kernel driver? thx

    Sure, I have used this module from @nukular https://forum.up-community.org/discussion/comment/9298/#Comment_9298 in a mcp2515_init.c file.
    Then add a simple Makefile:

    obj-m += mcp2515_init.o
    
    all:
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
    
    clean:
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
    

    Then:

    $ sudo apt install build-essential linux-headers-$(uname -r)
    $ make
    $ sudo insmod mcp2515_init.ko busnum=2 chip_select=1 gpio_int=25
    $ sudo ip link set can0 up type can bitrate 500000
    
This discussion has been closed.