This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Why nothing is output on pin of SPI3?

Hi folks!

I have a OMAP3 beagle-board running on Android. Now I am developing a protocol driver for McSPI3. But I can't output anything from pin of SPI3. I add several printk in the driver, and I can see the write and read to/from the register of SPI3. But nothing were output from it. I don't know the reason.

I had added the data into the message list. Then I call spi_saync(). The parameters for it is the device* of driver and the message list. The value returned from spi_async is 0, that means OK, although nothing was output. I wonder maybe I should set the parameters such as SPI_MODE, BITS_PER_WORD, and MAX_SPEED_IN_HZ before output data, then I do so. But the problem is still exist. Why? Maybe there are some problems in hardware? I noticed someone say he call clk_get() and clk_enable() to fix the problem. I did as them. But the return value of clk_enable() indicate an error occurred. Now I had no idea to fix it. I hope someone could be kind to help me. Thx!

  • Hello,

    There are two main steps apart from hardware connections - pinmux and board info.

    Please find the spi test patch in the below link

    https://github.com/RobertCNelson/stable-kernel/blob/v3.1.x/patches/beagle/0001-spi-testing.patch

    Also, there is one blog as well I find online http://www.brianhensley.net/2012/02/spi-working-on-beagleboard-xm-rev-c.html

    Best Regards,

    Arun

  • Glad to see your reply.

    I had check my pin mux again. The MUX configuration for McSPI3 in u-boot/board/ti/beagle/beagle.h are as following:

            MUX_VAL(CP(ETK_D0_ES2),         (IDIS  | PTU | DIS | M1)) /*MCSPI3_SIMO*/\
            MUX_VAL(CP(ETK_D1_ES2),         (IEN  | PTU | DIS | M1)) /*MCSPI3_SOMI*/\
            MUX_VAL(CP(ETK_D2_ES2),         (IDIS  | PTU | DIS | M1)) /*MCSPI3_CS0*/\
            MUX_VAL(CP(ETK_D7_ES2),         (IDIS  | PTU | DIS | M1)) /*MCSPI3_CS1*/\
            MUX_VAL(CP(ETK_D3_ES2),         (IDIS  | PTU | DIS | M1)) /*MCSPI3_CLK*/\
    I am sure that is correct. But the problem is still exist. Could you help me more? Thx!

  • Hello,

    Do you test SPI by spidev_test? What are the test logs?

    Best Regards,

    Arun

  • Hello,

    Maybe for the blocking of internet, I can't access the second URL you provided. I build the example driver spidev provided with linux and use it to test my hardware. I find nothing still outputed on SPI3. Maybe it's true that some problems of hardware exists. Now I am checking the hardware. Thank you!

    Regards!

    Johnny

  • Hi,

    I had found the source code of spidev_test. But it can only be build as x86 binary file. I don't know how to build it as ARM binary. Could you be kind to tell me the way? Thank you!

    Best Regards!

    Johnny

  • For test the function of the pin, I set McSPI3_CLK as GPIO17, then try to output 0 or 1 from it. But I find whether I write 0 or 1 to that pin, the output is always 1. Could you help me to check it? Part of pin-mux is as following:

    u-boot/board/ti/beagle/beagle.h:

    ...

        MUX_VAL(CP(ETK_D3_ES2),        (IDIS  | PTD | EN | M4)) /*GPIO_17*//*MCSPI3_CLK*/\
    ...

    Part code to output 0 or 1 on GPIO_17 is as following:

    ...

                int addr = 17;

                if(gpio_request(addr, "gpio") >= 0) {
                    gpio_direction_output(addr,1);
                    if(pDev->user_buff[i] == '0') {
                        printk(KERN_ALERT "WRITE 0\n");
                        gpio_set_value(addr, 0);
                    }
                    else if(pDev->user_buff[i] == '1') {
                        printk(KERN_ALERT "Write 1\n");
                        gpio_set_value(addr, 1);
                    }
                    mdelay(10);
                    gpio_free(addr);
                }
    ...

    Is the code above right? Plz help me! Thx!

  • Problem had been fixed by modify the configuration of USB1. Thx for all!