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.

spi device debugging

Guru 20755 points
Other Parts Discussed in Thread: AM1808

Hello,

I am using spi device, not available in linux GIT, and I've write a driver for it using the datasheet. The device is RTC RV-3049 (micro crystal).

On reading registers, I always get value 0 for all registers, on reading.

According to datasheet al least register 0x3 should have 1 at bit 5 after power on, but I see only 0.

I would like to ask if it is correct defining the device as SPI_MODE_1 . See the following read table:

If you have other ideas as to how to debug the device please tell me. Using fram with spi bus works OK (though another bus, and another cs)

Thanks,

Ran

  • Hello Ran,

    What is the register 0x3 bit 5 you are referring into ?

    Are you seeing any activity on CE, CLK and SDO signals when reading the registers ? Did you probe these signals ?

    Are you sure the RTC crystal is functioning well ?

    Regards,

    Senthil

  • 4571.rtc_RV-3049_App-Manual.pdf

    Hi Senthil,

    Thanks for the reply.

    I've attached the rtc datasheet.

    register 3 is control_status (in page 12 section 3.2.4) . According to datasheet, the PON  " Flag is set at Power-On, flag must be cleared by writing “0”

    Anyhow, I read only 0 from all registers so I suspect that I have very basic HW related problem. 

    I checked pinmux definition, seems OK.

    Can you please validate in datasheet that it is correct to set the spi device to SPI_MODE_1 (page 50 in datasheet). The datasheet only gives diagrams without specifying the spi mode.

    Thanks!

    Ran

  • Hello Ran,

    I suspect the problem is with the RTC crystal. Since you are seeing PON flag is not to 0 during power ON, the RTC might be in reset condition. The PON flag is set to 1 only the device is out of power on reset.

    Please ensure the RTC crystal external circuits are correct as per their recommendation and validate its functionality.

    Are you seeing the clock output at CLKOUT pin after enabling CLKOE ?

    If possible please share the schematics of processor to RTC interface ? This to verify the SPI connectivity.

    Regards,

    Senthil

  • Hi Ran,

    What processor are you using ?

  • Hi Titusrathinaraj Stalin,

    We tested the board and see that the CS is active low instead of the required active high with this RTC device.

    Do you know where is should be configured ? I am using DM8148 in this case.

    Thanks,

    Ran

  • Ran,

    Ran Shalit said:

    We tested the board and see that the CS is active low instead of the required active high with this RTC device.

    Do you know where is should be configured ? I am using DM8148 in this case.

    See if the below e2e thread will be in help:

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/379291.aspx

    Regards,
    Pavel

  • Hi Pavel,

    Thanks,

    SPI CS active high/low is part of spi "mode" , but we see that cs still behaves the same (change from 0 to 1)

    {
    .modalias = "rtc-rv3049",
    .max_speed_hz = 1000000,
    .chip_select = 1,
    .bus_num = 2,
    .mode = SPI_MODE_1 | SPI_CS_HIGH,

    },

    Thanks,

    Ran

  • Ran,

    Ran Shalit said:
    SPI CS active high/low is part of spi "mode" , but we see that cs still behaves the same (change from 0 to 1)

    Ran Shalit said:
    .mode = SPI_MODE_1 | SPI_CS_HIGH,

    Check if this SPI_CS_HIGH flag has been overwritten by some SW, check the McSPI registers settings.

    See also if the below e2e threads will be in help:

    http://e2e.ti.com/support/arm/sitara_arm/f/791/t/262948.aspx

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/297161.aspx

    http://e2e.ti.com/support/arm/sitara_arm/f/791/t/327117.aspx

    I have also found one fix for other device (am1808) but might be in help here also:

    0042.7673.spi_cs_polarity.txt

    Regards,
    Pavel

  • Thank you very much,

    it now works. It was an issue with the driver I wrote, it override the active high mode, (I mistakenely thought that the right value reached the below omap spi driver) , so the only requirement was to add SPI_CS_HIGH, as written in previous post. 

    Regards,

    Ran

  • Hi Ran,

    Sounds good.

    Thanks for your update.