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.

Linux/AM3358: McSPI Slave issue

Part Number: AM3358


Tool/software: Linux

Hello 

I have designed a custom board of AM3358 based on AM335X General Purpose EVM in which I have configured the SPI0 as slave (changing the register values in the kernel).

The problem is when a master is driving the chip select signal and sck signal  , AM3358's SPI port is pulling the lines low and making the Chip select and sck signals run from 1V to 0V instead of 3.3V to 0V.

How to avoid this to happen?

Regards

Mad_hu

  • Please post your pinmux settings. Which pins do you use? Post schematic portion if possible.
  • Hello Biser,

    The following is the code written in the dts file regarding the SPI.  SPI is working fine when configured in master mode but problem exists when configured as slave. The  spi0_cs0 is tried with both OUTPUT and INPUT but of no use.

    spi0_pins: pinmux_spi0_pins {

                      pinctrl-single,pins = <

                           AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE0)  /* spi0_sclk.spi0_sclk */

                            AM33XX_IOPAD(0x954, PIN_OUTPUT_PULLUP | MUX_MODE0)  /* spi0_d0.spi0_d0 */

                            AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0)  /* spi0_d1.spi0_d1 */

                           AM33XX_IOPAD(0x95C, PIN_INPUT_PULLUP | MUX_MODE0)   /* spi0_cs0.spi0_cs0 */

                   >;

               };

    &spi0{

         pinctrl-0=<&spi0_pins>;

    status="okay";

    pinctrl-names = "default";

    ti,pindir-d0-out-d1-in=<1>;

    spidev@0{

    compatible="linux,spidev";

    spi-max-frequency=<48000000>;

    reg=<0x0>;

    status="okay";

    };

    };

    The schematic section of the SPI is attached here. The SPI lines from AM3358 are directly connected to the I2S of another IC.

    Regards

    Mad_hu

  • Are you sure the external device can drive the lines? You can check by configuring CS and SCK as GPIO inputs. Also please note that SPI Slave mode is a non-supported use case in the Linux Processor SDK.
  • Hello Biser,
    If i configure those pins as GPIO's the problem is not coming .
    The problem comes into picture when I configure them as SPI.

    Regards
    Mad_hu
  • It seems that you have a conflict with the SPI driver. If you use the SPI driver that comes with the Linux SDK without any modification it will not support Slave mode. This is clearly stated here: processors.wiki.ti.com/.../Linux_Core_SPI_User's_Guide
  • Hello Biser,

    I have not changed much . I have only changed a single bit in the SPI setting which made it to work as a slave .After going through Technical Reference manual I have changed only one bit i.e MS bit to make it a slave.

    Are there any other any other changes that need to be done to make it a slave. Kindly help me what changes to be needed as a hardware change. handling them in the kernel i will do it


    Regards
    Mad_hu
  • Hi Mad_hu,

    Can you try reading the actual Pad Control (Pinmux Config) registers for the SPI CLK and CS pins and share the results?

    I would except to see the following configuration: PULLUDEN = 0, PULLTYPESEL = 1, and RXACTIVE = 1.

    Regards,
    Melissa
  • Hi Melissa

    Can you tell me how to read those Pad control Registers i.e. pinmux config


    Regards
    Mad_hu
  • Hi Mad_hu,

    After your board has booted and the SPI driver has been installed, you can issue the following commands in your debug console:

    devmem2 0x44E10950
    devmem2 0x44E1095C

    The first line will read the SPI0_CLK padconfig register, and the second line reads the SPI0_CS0 padconfig.

    Regards,
    Melissa
  • Hello Melissa

    I didn't try that because the problem is I wanted to use Framed SPI model , My driver cannot generate that so I wanted to use the signals generated form another source, but later came to know that even though I am a slave I will respond with the help of my driver only.

    As my driver wont support that there is no point in having configuring to slave mode.


    Can you help me in configuring any another driver which gives framed SPI mode or any other SPI mode other than the basic modes.



    Regards
    Mad_hu.
  • Hi Mad_hu,

    Based on what I've read about Framed SPI mode, it doesn't look like AM335x's SPI (hardware) will be able to achieve the required frame sync signal.

    Look into the AM335x McASP and PRU-ICSS. The Framed SPI mode may be able to be achieved using one of these IPs. I saw mention of I2S/TDM on one article about this SPI mode. These types of protocols are supported by the McASP. Also, the PRU-ICSS has been used to implement standard and custom software peripherals (i.e. SPI, UART, etc). More details about the PRU-ICSS can be found here-- processors.wiki.ti.com/.../PRU-ICSS.

    Regards,
    Melissa