mhc

Members
  • Content Count

    18
  • Joined

  • Last visited

 Content Type 

Forums

Member Map

Store

Crowdfunding

Applications

Calendar

Everything posted by mhc

  1. Hi martinayotte, many thanks for your comments. I changed armbianEnv.txt file according your suggestion, but spi dev did not appear, however I modified compatible property in .dtsi (from "allwinner,sun8i-spi" to "allwinner,sun8i-h3-spi"; and after a reboot spidev0.0 does appear (even excluding overlay property in armbianEnv.txt). allwinner,sun8i-spi made sense to me, it is difficult for me to know which driver to use in each case. So, here is my working environment just in case someone has the same problem and wants to use it. sun8i-r40.dtsi spi0_pins: spi0-pins { pins = "PC0", "PC1", "PC2"; function = "spi0"; }; spi0: spi@1c05000 { compatible = "allwinner,sun8i-h3-spi"; device_type = "spidev"; reg = <0x01c05000 0x1000>; interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>; clock-names = "ahb", "mod"; pinctrl-names = "default"; pinctrl-0 = <&spi0_pins>; resets = <&ccu RST_BUS_SPI0>; status = "disabled"; #address-cells = <1>; #size-cells = <0>; }; And sun8i-r40-bananapi-m2-ultra.dts &spi0 { status = "okay"; num-chipselects = <1>; cs-gpios = <&pio 2 23 GPIO_ACTIVE_LOW>; // CS = PC23 spidev@0 { reg = <0>; compatible = "spidev"; status = "okay"; spi-max-frequency = <1000000>; }; }; Thanks again! mhc
  2. Hi all. Firstly, sorry I had posted this query in the wrong forum. I´m trying to add support for a raw SPI comunication through SPI0, as it´s a custom comunication with a little auxiliary board, I think best option is to have a spidev device. My scenario is: Banana pi m2 ultra Armbian 5.4.35-sunxi, server (No gui). I have been modifying .dts and .dtsi files, here are parts of the files that I modified: sun8i-r40.dtsi spi0_pins: spi0-pins { pins = "PC0", "PC1", "PC2"; function = "spi0"; }; spi0: spi@1c05000 { compatible = "allwinner,sun8i-spi"; device_type = "spidev"; reg = <0x01c05000 0x1000>; interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>; clock-names = "ahb", "mod"; pinctrl-names = "default"; pinctrl-0 = <&spi0_pins>; resets = <&ccu RST_BUS_SPI0>; status = "disabled"; #address-cells = <1>; #size-cells = <0>; }; sun8i-r40-bananapi-m2-ultra.dts &spi0 { status = "okay"; num-chipselects = <1>; cs-gpios = <&pio 2 23 GPIO_ACTIVE_LOW>; // CS = PC23 spidev@0 { reg = <0>; compatible = "spidev"; status = "okay"; spi-max-frequency = <1000000>; }; }; I created a script to compile these files !/bin/bash sudo cpp -nostdinc -I include -I arch -undef -x assembler-with-cpp arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts preproc.dts dtc -I dts -O dtb -o sun8i-bananapi-m2-ultra.dtb preproc.dtc And I get my new dts. As a comment, the compilation of the device tree throws me this warning: sun8i-r40-bananapi-m2-ultra.dtb: Warning (unit_address_vs_reg): Node /clocks/clk@1 has a unit name, but no reg propert However, I think it is prior to my modifications, because if I delete all my changes the warning is already there. So, next step, I procede to replace original dtb in Banana pi with the one that I just generated, under /boot/dtb-5.4.35-sunxi/ And then, reboot. I expected to get spix.y device under /dev but there is no change here. If i decompile my new dtb, I can see spi spi0-pins { pins = "PC0", "PC1", "PC2"; function = "spi0"; phandle = <0x20>; }; spi@1c05000 { compatible = "allwinner,sun8i-spi"; reg = <0x1c05000 0x1000>; interrupts = <0x0 0xa 0x4>; clocks = <0x7 0x29 0x7 0x71>; clock-names = "ahb", "mod"; pinctrl-names = "default"; pinctrl-0 = <0x20>; resets = <0x7 0x11>; status = "okay"; #address-cells = <0x1>; #size-cells = <0x0>; num-chipselects = <0x1>; cs-gpios = <0xd 0x2 0x17 0x1>; So, Could somebody please tell me what thing (or probably things) I am doing wrong, or if there are any steps I am forgetting? Just in case, I modified the armbianEnv.txt that way overlay=spi-spidev param_spidev_spi_bus=0 to add the spidev overlays (although if I'm not wrong this shouldn't be necessary, since I already enabled spi from the dts, is that correct?) Thanks in advance to anyone who takes the time to read my issue, and if you have any suggestions, they will be more than welcome. Regards. mhc
  3. Got it Werner, I want to really thank you for your time and your clear explanation. I'll try it! Regards
  4. Firstly, thanks for your answer Werner, and sorry for delay in my answer, I could connect again just today. Things are exactly has you said, here is my board file in /build/config/boards/bananapim2ultra.csc # R40 quad core 2Gb SoC Wifi eMMC BOARD_NAME="Banana Pi M2U" BOARDFAMILY="sun8i" BOOTCONFIG="Bananapi_M2_Ultra_defconfig" OVERLAY_PREFIX="sun8i-r40" KERNEL_TARGET="current,dev" It is my family file /build/config/sources/families/sun8i.conf source "${BASH_SOURCE%/*}/include/sunxi_common.inc" if [[ -z ${OVERLAY_PREFIX} ]]; then OVERLAY_PREFIX='sun8i-h3' fi [[ -z $CPUMIN ]] && CPUMIN=480000 [[ -z $CPUMAX ]] && CPUMAX=1400000 family_tweaks_s() { if [[ ${BOARD} == nanopi-r1 ]]; then # rename eth1 to wan0 echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",ATTR{address}=="00:00:00:00:00:00",ATTR{dev_id}=="0x0", ATTR{type}=="1",KERNEL=="eth1", NAME="wan0"' > $SDCARD/etc/udev/rules.d/70-persisetn-net.rules # change default console to tty1 which is wired to the chasis sed -i "s/ttyS0/ttyS1/" $SDCARD/boot/boot.cmd mkimage -C none -A arm -T script -d $SDCARD/boot/boot.cmd $SDCARD/boot/boot.scr fi } And finally here is /build/config/sources/families/include/sunxi_common.inc, the file that contains links to kernel's source. ARCH=armhf BOOTDELAY=1 BOOTPATCHDIR='u-boot-sunxi' UBOOT_TARGET_MAP=';;u-boot-sunxi-with-spl.bin' BOOTSCRIPT="boot-sunxi.cmd:boot.cmd" BOOTENV_FILE='sunxi-default.txt' LINUXFAMILY=sunxi UBOOT_FW_ENV='0x88000,0x20000' # /etc/fw_env.config offset and env size ASOUND_STATE='asound.state.sunxi-next' GOVERNOR=ondemand case $BRANCH in legacy) KERNELBRANCH='branch:linux-4.19.y' KERNELPATCHDIR='sunxi-'$BRANCH ;; current) KERNELSOURCE="https://github.com/megous/linux" KERNELBRANCH="branch:orange-pi-5.4" KERNELPATCHDIR='sunxi-'$BRANCH ;; dev) KERNELSOURCE="https://github.com/megous/linux" KERNELBRANCH="branch:orange-pi-5.5" KERNELPATCHDIR='sunxi-'$BRANCH ;; esac family_tweaks() { # execute specific tweaks function if present [[ $(type -t family_tweaks_s) == function ]] && family_tweaks_s cp $SRC/packages/blobs/splash/armbian-u-boot-24.bmp $SDCARD/boot/boot.bmp } family_tweaks_bsp() { # execute specific tweaks function if present [[ $(type -t family_tweaks_bsp_s) == function ]] && family_tweaks_bsp_s } write_uboot_platform() { dd if=/dev/zero of=$2 bs=1k count=1023 seek=1 status=noxfer > /dev/null 2>&1 dd if=$1/u-boot-sunxi-with-spl.bin of=$2 bs=1024 seek=8 status=noxfer > /dev/null 2>&1 } setup_write_uboot_platform() { if grep -q "ubootpart" /proc/cmdline; then local tmp=$(cat /proc/cmdline) tmp="${tmp##*ubootpart=}" tmp="${tmp%% *}" [[ -n $tmp ]] && local part=$(findfs PARTUUID=$tmp 2>/dev/null) [[ -n $part ]] && local dev=$(lsblk -n -o PKNAME $part 2>/dev/null) [[ -n $dev ]] && DEVICE="/dev/$dev" elif [[ -f /var/lib/armbian/force_search_uboot ]]; then # This may cause overwriting u-boot for android or other non-Armbian OS installed on eMMC # so don't run this function by default for dev in $(lsblk -d -n -p -o NAME); do if grep -q 'eGON.BT0' <(dd if=$dev bs=32 skip=256 count=1 status=none); then # Assuming that only one device with SPL signature is present echo "SPL signature found on $dev" >&2 DEVICE=$dev break fi done fi } So, if I'm not wrong, I can't get a specific kernel version (for example 5.4.29) from a branch, I have to select a branch (legacy, current or dev) and it gives me the last version of this branch. Am I right?
  5. Mmmmmmmh, I don't know where is my error, finally compile is done, but now I've 2 problems. Firstly, Although I have compiled using the following statement: sudo ./compile.sh INSTALL_HEADERS=yes OFFLINE_WORK=yes BUILD_MINIMAL=yes and have received this messagges at begining of compilation process: /tmp/tmp.lU8KzaKHib: line 4: update_src: command not found [ o.k. ] Using config file [ /compilacion_viejo_kernel/Armbian-5.4.29/build/userpatches/config-example.conf ] [ o.k. ] Command line: setting INSTALL_HEADERS to [ yes ] [ o.k. ] Command line: setting OFFLINE_WORK to [ yes ] [ o.k. ] Command line: setting BUILD_MINIMAL to [ yes ] [ .... ] * [ You are working offline. ] [ .... ] * [ Sources, time and host will not be checked ] when compilation is finished, I just have this output files: /compilacion_viejo_kernel/Armbian-5.4.29/build/output/images/Armbian_20.08.0-trunk_Bananapim2ultra_bionic_current_5.4.47_minimal.img /compilacion_viejo_kernel/Armbian-5.4.29/build/output/images/Armbian_20.08.0-trunk_Bananapim2ultra_bionic_current_5.4.47_minimal.img.sha /compilacion_viejo_kernel/Armbian-5.4.29/build/output/images/Armbian_20.08.0-trunk_Bananapim2ultra_bionic_current_5.4.47_minimal.img.txt I tried with kernel version 5.4.29, instead of 4.19, but I think it doesn't matter for this issue??? My second problem is also, when I flash img file using etchoer, just like ever did it, system doesn't boot at all. I know HW is working, cause if I flash SD card with other image file, everything works fine. Is there some obvious thing that I'm missing? Thanks in advances!
  6. Thanks again Werner, I'm compiling now, adding ./compile.sh INSTALL_HEADERS=yes OFFLINE_WORK=yes I will confirm results when it end. Regards!
  7. Yes werner, I think offline mode will be fine for me, I just need to preserve source files to re-generate 4.19 image (if I do it normal way I think my generated image will be 5.4.47). Sorry for basic questions, how do I setup offline mode?
  8. Hi all! I need to back to an older kernel version that I had used past year. In my PC, I conserve without any kind of changes, the working directory used to run compile.sh. If I did not missunderstood my Armbian documentation reading, there is an option to tell compilation process that don't try to upgrade sources files before compile (touch .ignore_changes). Am I right? And, if it's fine, Could somebody please explain me where and how must I apply these parameter? Thanks in advances! Edit: You could ask. Why he want to re-compile if he has past_year.img file? The reason is I need to include kernel headers nad my old compilation does not have them. Mariano
  9. I think I found a solution to this problem, based on a post I read in some forum and confirmed in this thread (Really thanks to all who helped there). Base clock for GPIO interrupts was configured to work in low speed (LOSC 32KHz), and then 10us pulses can frequently be unnoticed. I installed devmem2, and wrote a new value of 1 in bit 0 (PIO_INT_CLK_SELECT) of PIO_INT_DEB (see details below) PIO Base Address = 0x01C20800 PIO_INT_DEB = 0x0218 So, final address: 0x01C20800 + 0x0218 = 0x01C20A18 And now I can read 26 bits of lossless data. So, now I just have to decide if I work with this approach, or if, like martinayotte said, I use a dedicated subsystem to deal with it (this second approach will give me more flexibility, cause we frequently have to work with other standards that aren't Wiegand at all). Just in case I keep the first option, based in your experience. What is the best way to have EINT clock modified to HOSC? Should I work with my already modified .dts file? ( I had to change the original .dts file to add ALSA record support and enable UART2 & UART5). And one more question, do you think that modified EINT clock will cause some undesirable secondary effect? I know no one is a clairvoyant, but I'm just wondering if there are any obvious consequences that I'm missing. Thanks for your recomendation. Regards.
  10. Hi martinayotte, yes you´re right! I thought about exactly this option (and I'm still considering it), but beyond that I would like to understand what is happening.
  11. Hi Werner, many thanks for your answer, I honestly didn't know that tool. Here it is. http://ix.io/2mYB Please let me know if there is something else that I can add. Regards! mhc
  12. Hello everyone. From some time ago I´m working in an application that comunicates with some external devices, using GPIOs. With this aim, I´ve programmed my own driver with its methods, whose are automatic loaded at startup. My hardware is a BananaPi m2u, and kernel version is 5.4.35-sunxi. Now, I´ve to read an external HW that has 2 data lines, whose idle state is "high" and once per minute sends a packet of 26 bits of data. One of these lines is a Data0 signal, and the other is Data1 signal. Every pulse is around 100us, and there is an idle interval of about 2ms between one bit and the next. There is no way for data line 0 and data line 1to be active simultaneously. I`ve writed a new driver using Falling edge interrupts, data lines are connected to BMC224 (Pin 31 of header) & BCM225 (Pin 33 of header). Now I´m having troubles when pulses of external hardware arrives, I´m always loosing some of this 26 pulses. (I receive from 10 to 16 pulses, and lose the rest). I'm helping myself by using tail -f /cat/log/syslog to watch kernel messages (I used some temporally printk inside interrupt handler, just to debug). Here is a screenshot where you can see there is 6 correct received pulses before my problem arises (between time 829.536885 and 829.547099) root@bananapim2ultra:/home/pi/TK401# tail -f /var/log/syslog May 21 19:45:01 localhost CRON[1923]: (root) CMD (/usr/lib/armbian/armbian-truncate-logs) May 21 19:45:01 localhost wpa_supplicant[1138]: wlan0: Failed to initiate sched scan May 21 19:45:16 localhost kernel: [ 817.446427] usb 4-1: USB disconnect, device number 14 May 21 19:45:18 localhost kernel: [ 819.128519] usb 4-1: new low-speed USB device number 15 using ohci-platform May 21 19:45:18 localhost kernel: [ 819.355553] usb 4-1: New USB device found, idVendor=0458, idProduct=003a, bcdDevice= 1.00 May 21 19:45:18 localhost kernel: [ 819.355563] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 May 21 19:45:18 localhost kernel: [ 819.355569] usb 4-1: Product: USB Optical Mouse May 21 19:45:18 localhost kernel: [ 819.355575] usb 4-1: Manufacturer: Genius May 21 19:45:18 localhost kernel: [ 819.362882] input: Genius USB Optical Mouse as /devices/platform/soc/1c1c400.usb/usb4/4-1/4-1:1.0/0003:0458:003A.0010/input/input18 May 21 19:45:18 localhost kernel: [ 819.363214] hid-generic 0003:0458:003A.0010: input,hidraw2: USB HID v1.11 Mouse [Genius USB Optical Mouse] on usb-1c1c400.usb-1/input0 May 21 19:45:29 localhost kernel: [ 829.536885] 0 May 21 19:45:29 localhost kernel: [ 829.538920] 0 May 21 19:45:29 localhost kernel: [ 829.540969] 1 May 21 19:45:29 localhost kernel: [ 829.543009] 1 May 21 19:45:29 localhost kernel: [ 829.545057] 1 May 21 19:45:29 localhost kernel: [ 829.547099] 1 May 21 19:45:29 localhost kernel: [ 829.557355] 0 May 21 19:45:29 localhost kernel: [ 829.559398] 1 May 21 19:45:29 localhost kernel: [ 829.561445] 1 May 21 19:45:29 localhost kernel: [ 829.563487] 0 But suddenly, after sixth bit, there is no more handled pulses for a time period of 10ms, IMHO that looks like some higher hierarchy proccess is blocking my interrupts, and so, there is a lot of pulses lost. Also if I look at /proc/interrupts I can see there was 4 received interrupts from D0 (CPU0) and 6 from D1 (CPU0), so there is a match between info provided in both files. My testing code from user space is just a big sleep, so I think there is nothing there that can cause problems. Trying to understand where is this problem originated, I installed WiringPi (a library that provides access to GPIO, and includes interrupt driven inputs), I had to modify some pieces of code, cause they don´t like to work with "weird fruits Pi". With this apporoach I obtained a similar result (I loose about the same number of data bits), however if I use it in a Raspberry with Raspbian, I can read hundreeds od data packets with no looses at all. Could any of you please indicate where I can start looking for my error? Many thanks in advance! mhc.
  13. Hi Igor, thank you very much for your answer. I understand that you contribute by using time you could spend on other things, and I am completely grateful for that. I will help if I found something that " know how" from your link Greetings
  14. Werner, kernel header update worked like a charm. I tried both ways armbian-config -> Software -> Headers_install apt install linux-headers-current-sunxi So, I´m wondering if there is a way to just install headers that match current target´s kernel version if kernel version is not the last stable. In my case, after installing headers I had to upgrade kernel to 5.4.35, no problem at all, but I guess sometimes we might want to keep kernel version unchanged. One more time, thank you very much!
  15. Wow Werner, that was fast! I´ll try it now, and let you know the result. Many thanks!!!
  16. Hi all, First place, sorry if it´s a very basic question, I was searching info and reading topics, but I did not found a solution for my problem. I`m working with Linux version 5.4.29-sunxi I´m trying to compile my own char device driver. I noticed that I forgot adding kernel-headers in my build, so I tried to add them via apt install linux-headers-next-sunxi After that, I can see a new directory /usr/src/linux-headers-4.19.62-sunxi but if I´m not wrong, modules compiled with this headers won´t work in my kernel, cause headers version does not match with my kernel version. So, could please someone give me a hint about getting correct header version, or if I´m completelly wrong? Many thanks in advances Grettings Mariano
  17. Dear Asimov, your instructions worked perfectly for me. Many thanks mhc