Jump to content

A13 SOM enable 24MHz oscillator


FrikoAnPulento

Recommended Posts

Hello,

I'm using Armbian (kernel version 5.0.21-sunxi) on an Olimex a13 SOM.

I'm trying to implement wiegand interface on GPIO pins, that means that I have to fire interrupts on 50uS pulses.

I solved my problem with writing down a driver capturing edge triggered inputs.

So, with some readers (200uS pulses, 1.5ms between pulses) i can get all data, but with other readers (e.g. 100uS pulse, 500uS between pulses) I miss some interrupts (e.g. I have a wiegand42 reader and sometimes I get 41 interrupts, sometimes I get 39 or 36).

I read that kernel fires new interrupt only when the previous interrupt function has returned, so I tested it with just adding a "counter++" and "if (counter>41)" and I'm still not able to get every interrupt.

I found on forums that allwinner a13 has an external 24MHz oscillator (Q1 in this schematic https://www.olimex.com/Products/SOM/A13/A13-SOM-512/resources/A13-SOM512_sch.pdf ) that can be configured to trigger interrupt events faster.

I tried to add to kernel sources patch found in here (https://linux-sunxi.org/External_interrupts), but gives me error while kernel compiles.

I've also read this topic ( https://forum.armbian.com/topic/4787-gpio-pa19-hardware-interrupts/?tab=comments#comment-36517 ), but I can't figure out how to enable 24MHz oscillator in device tree (I tried "input-debounce = <0x1>;" on "pinctrl@1c20800" without result).

Could someone help me in enabling 24MHz oscillator for firing external interrupts?

Here's my pinctrl section of device tree:

Quote

pinctrl@1c20800 {
            reg = <0x1c20800 0x400>;
            interrupts = <0x1c>;
            clocks = <0x2 0x35 0x14 0x15>;
            clock-names = "apb", "hosc", "losc";
            gpio-controller;
            interrupt-controller;
            #interrupt-cells = <0x3>;
            #gpio-cells = <0x3>;
            input-debounce = <0x1 0x1 0x1>;
            compatible = "allwinner,sun5i-a13-pinctrl";
            phandle = <0xd>;

            emac-pd-pins {
                pins = "PD6", "PD7", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PD18", "PD19", "PD20", "PD21", "PD22", "PD23", "PD24", "PD25", "PD26", "PD27";
                function = "emac";
                phandle = <0x3a>;
            };

            i2c0-pins {
                pins = "PB0", "PB1";
                function = "i2c0";
                phandle = <0x17>;
            };

            i2c1-pins {
                pins = "PB15", "PB16";
                function = "i2c1";
                phandle = <0x18>;
            };

            i2c2-pins {
                pins = "PB17", "PB18";
                function = "i2c2";
                phandle = <0x19>;
            };

            ir0-rx-pin {
                pins = "PB4";
                function = "ir0";
                phandle = <0x3b>;
            };

            lcd-rgb565-pins {
                pins = "PD3", "PD4", "PD5", "PD6", "PD7", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PD19", "PD20", "PD21", "PD22", "PD23", "PD24", "PD25", "PD26", "PD27";
                function = "lcd0";
                phandle = <0x3c>;
            };

            lcd-rgb666-pins {
                pins = "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PD18", "PD19", "PD20", "PD21", "PD22", "PD23", "PD24", "PD25", "PD26", "PD27";
                function = "lcd0";
                phandle = <0x6>;
            };

            mmc0-pins {
                pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
                function = "mmc0";
                drive-strength = <0x1e>;
                bias-pull-up;
                phandle = <0xb>;
            };

            mmc2-8bit-pins {
                pins = "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15";
                function = "mmc2";
                drive-strength = <0x1e>;
                bias-pull-up;
                phandle = <0x3d>;
            };

            mmc2-4bit-pc-pins {
                pins = "PC6", "PC7", "PC8", "PC9", "PC10", "PC11";
                function = "mmc2";
                drive-strength = <0x1e>;
                bias-pull-up;
                phandle = <0x3e>;
            };

            nand-pins {
                pins = "PC0", "PC1", "PC2", "PC5", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15";
                function = "nand0";
                phandle = <0x3f>;
            };

            nand-cs0-pin {
                pins = "PC4";
                function = "nand0";
                phandle = <0x40>;
            };

            nand-rb0-pin {
                pins = "PC6";
                function = "nand0";
                phandle = <0x41>;
            };

            spi2-pe-pins {
                pins = "PE1", "PE2", "PE3";
                function = "spi2";
                phandle = <0x42>;
            };

            spi2-cs0-pe-pin {
                pins = "PE0";
                function = "spi2";
                phandle = <0x43>;
            };

            uart1-pe-pins {
                pins = "PE10", "PE11";
                function = "uart1";
                phandle = <0x44>;
            };

            uart1-pg-pins {
                pins = "PG3", "PG4";
                function = "uart1";
                phandle = <0x16>;
            };

            uart2-pd-pins {
                pins = "PD2", "PD3";
                function = "uart2";
                phandle = <0x45>;
            };

            uart2-cts-rts-pd-pins {
                pins = "PD4", "PD5";
                function = "uart2";
                phandle = <0x46>;
            };

            uart3-pg-pins {
                pins = "PG9", "PG10";
                function = "uart3";
                phandle = <0x47>;
            };

            uart3-cts-rts-pg-pins {
                pins = "PG11", "PG12";
                function = "uart3";
                phandle = <0x48>;
            };

            pwm0-pin {
                pins = "PB2";
                function = "pwm";
                phandle = <0x1d>;
            };

            led-pin {
                pins = "PG9";
                function = "gpio_out";
                drive-strength = <0x14>;
                phandle = <0x22>;
            };

            usb0-id-detect-pin {
                pins = "PG2";
                function = "gpio_in";
                bias-pull-up;
                phandle = <0x10>;
            };

            usb0-vbus-detect-pin {
                pins = "PG1";
                function = "gpio_in";
                bias-pull-down;
                phandle = <0x11>;
            };
            
            wiegand1-D0-pin    {
                pins="PB3";
                function="irq";
                phandle = <0x5f>;
            };
            
            wiegand1-D1-pin    {
                pins="PB10";
                function="irq";
                phandle = <0x60>;
            };
        };

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines