Jump to content

Something Name

Members
  • Posts

    8
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Something Name reacted to Fran A100 in MCP2515 CAN Controller on Allwinner D1 (MangoPi Mqpro)   
    Hi!
     
    Normally in a normal SBC you add an overlay with something like /boot/uEnv.txt etc... But this is not done yet. The workarround I made to work is to use Ubuntu (from oficial webpage of ubuntu, I used the Lichee version, or even the one shipped for the lichee that has the wifi driver already installedd), that is prepared also for running the mangoPi) and change group. My explanation:
     
    On the default installation of ubuntu, the only way to add overlays is with grub. The default ubuntu is configured to load the devicetree overlays with grub. So if we want to add overlays, we need to change the grub.
    To add a new entry on the grub we need to go to `/etc/grub.d/40_custom` and there we put the entry we want. The best way is to copy the same information that is in /boot/grub/grub.cfg regarding to the OS, like:
     
    menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-90836834-7e07-48ca-b0f9-29880429770d' {         load_video         insmod gzio         if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi         insmod part_gpt         insmod ext2         search --no-floppy --fs-uuid --set=root 90836834-7e07-48ca-b0f9-29880429770d         echo    'Loading Linux 5.19.0-1015-allwinner ...'         linux   /boot/vmlinuz-5.19.0-1015-allwinner root=/dev/mmcblk0p1 ro  quiet splash         echo    'Loading device tree blob...'         devicetree      /boot/dtb }  
    My modified version would be:
     
    menuentry 'UbuntuWithOverlays' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'ubuntu-custom-overlay'' {     load_video     insmod gzio     if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi     insmod part_gpt     insmod ext2     search --no-floppy --fs-uuid --set=root 90836834-7e07-48ca-b0f9-29880429770d     echo    'Loading Linux 5.17.0-1003-allwinner ...'     linux    /boot/vmlinuz-5.17.0-1003-allwinner root=LABEL=cloudimg-rootfs ro  quiet splash     echo    'Loading initial ramdisk ...'     initrd    /boot/initrd.img-5.17.0-1003-allwinner     echo    'Loading device tree blob...'     devicetree    /boot/overlay/my_overlay.dtb }  
    To make that entry the default in grub you need to add `GRUB_DEFAULT="ubuntu-custom-overlay"` to `/etc/default/grub`.
    After some testing I realized that there can be only one command of devicetree, it is not supported the overlays, the comfiguration is cleaned in every devicetree command. But you can get the original devicetree, modify and put it in the command, that works.

    Dont forget to do `update-grub` after.
     
    To get the device tree blob that comes with the board, you need to run `dtc -I fs /proc/device-tree`
     
    PD: In this post I confuse Overlay with the device tree configuration. There is no overlay, is a complete device tree blob, have that in mind.
  2. Like
    Something Name got a reaction from going in Mango Pi MQ-Pro (D1) Device Tree. Try to "okay" serial   
    5.19.0-1015-allwinner riscv64
  3. Like
    Something Name reacted to Fran A100 in MCP2515 CAN Controller on Allwinner D1 (MangoPi Mqpro)   
    Finally I made it! Thanks a lot for the help but it was something else. The final overlay is the next one:
     
    /dts-v1/; /plugin/; / { compatible = "allwinner,d1-nezha\0allwinner,sun20i-d1"; fragment@0 { target-path = "/clocks"; __overlay__ { #address-cells = <1>; #size-cells = <1>; /* External crystal oscillator on the board */ can0_osc_fixed: can0_osc_fixed { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <8000000>; phandle = <0x81>; }; }; }; fragment@1 { target = <&pinctrl>; // pinctrl@2000000 __overlay__ { can0_pin_irq: can0_pin_irq { pins = "PD17"; function = "irq"; phandle = <0x85>; bias-pull-up; }; }; }; fragment@2 { target = <&spi>; //spi@4026000 __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; mcp2515 { reg = <0>; // SPI 1 compatible = "microchip,mcp2515"; pinctrl-names = "default"; pinctrl-0 = <0x85>; spi-max-frequency = <10000000>; interrupt-parent = <0x22>; // pinctrl@2000000 interrupts = <3 17 8>; // IRQ LINE, try with <0 65 2> clocks = <0x81>; status = "okay"; }; }; }; };  
    I learnt some things about the interrupts field:
    * The part of interrupts is like this, <BANK NUMBER TYPE_INTERRUPT>
    * BANK is like, A -> 0, B-> 1, C->2, D->3
    * NUMBER, PD17 -> 17
    * TYPE_INTERRUPT, is described here
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines