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.

AM6422: Initialize the SPI device and transmit sample data to a connected slave from the U-Boot loader

Part Number: AM6422
Other Parts Discussed in Thread: SYSCONFIG, AM62P

Tool/software:

Hi TI Support Team,

For your information, I am using SDKv09.02.01.10.

Please provide sample instructions or code to initialize the SPI device and transmit sample data to a connected SPI slave from the U-Boot loader. Also, can you please tell me the APIs to initialize the SPI device?

Regards, Kalyan

  • Everything to do basic SPI device testing (send/transmit data) should be baked into U-Boot already. This functionality is accessed through the `sspi` command. What's needed are appropriate device tree definitions for SPI including a device alias I think.

    I'll see that I can find some time this week to create a working example for you to follow.

    Regards, Andreas

  • Thank you for your response. I look forward to receiving a working example of SPI device testing(send/transmit data).

    Also, could you please let me know if there is a U-Boot command available to check the list of connected SPI slaves and their device information?

    Regards, Kalyan

  • Also, could you please let me know if there is a U-Boot command available to check the list of connected SPI slaves and their device information?

    No, this is something you will need to manage manually based on data you send and compare against known patterns you expect to receive for certain devices. Unlike I2C, such a probing approach for SPI would be a lot less organic to manage. Plus, for SPI you only really have one devices connected per SPI HW peripheral, and you should know what that is from a HW design POV. Unlike I2C, which is a true bus.

    Regards, Andreas

  • Kalyan,

    I'll see that I can find some time this week to create a working example for you to follow.

    Working on a different support case involving AM62P I created two patches that allow using the `sspi` U-Boot command like utility-- please see attached. The changes for AM64x will be slightly different (pinmux, please use SysConfig tool to figure this piece out for AM64), and the file names of files to edit will be different of course. But you should be able to figure this out without too much trouble.

    Then, at U-Boot prompt, you can access the SPI interface as follows:

    U-Boot 2024.04-00002-gc685c5d14bf (Mar 12 2025 - 02:44:52 -0500)
    
    SoC:   AM62PX SR1.0 HS-FS
    Model: Texas Instruments AM62P5 SK
    DRAM:  2 GiB (effective 8 GiB)
    Core:  87 devices, 31 uclasses, devicetree: separate
    MMC:   mmc@fa10000: 0, mmc@fa00000: 1
    Loading Environment from nowhere... OK
    In:    serial
    Out:   serial
    Err:   serial
    Net:   eth0: ethernet@8000000port@1
    Warning: ethernet@8000000port@2 (eth1) using random MAC address - 42:56:1d:3c:35:25
    , eth1: ethernet@8000000port@2
    Hit any key to stop autoboot:  0
    => sspi 1:0.3@1000000 16 8fff
    FFFF
    =>

    Note that the first parameter (`1`) for the `sspi` command corresponds to the device tree SPI alias (`spi1`) that the patches add.

    Regards, Andreas

    0001-arm-dts-k3-am62p5-sk-Configure-SPI0-for-U-Boot-use.patch

    0002-configs-am62px_evm_a53_defconfig-Enable-SPI-driver.patch

    Regards, Andreas

  • Hi Andreas, Thank you for sharing the cmd sample. I will try it and inform you of the result.

    Regards, Kalyan

  • Hi Andreas,

    Did you get the chance to create a working example of SPI device testing (sending/transmitting data)?

    Thanks in advance.

    Regards,Kalyan

  • Did you get the chance to create a working example of SPI device testing (sending/transmitting data)?

    This was already provided in the earlier post; there's nothing else we can provide here. You'll need to follow the steps/patches to activate the `sspi` command support, and then you can use that to probe/check the SPI bus, for example for known-good ID values of external SPI devices that you might be expecting to compare against.

    Note that I'll be on PTO until e/o March so further responses here will be delayed.

    Regards, Andreas

  • Hi Andreas,

    As you suggested I have modified k3-am642-evm.dts and configs/am64x_evm_a53_defconfig files. When I ran the sspi command I got a 0000 response. Can you please let me know what I have missed?

    ERROR:

    dts file:

    config params:

  • I'm out of the office until end of March, will have another look on that after I'm back. In the meantime I'd recommend you attach a logic analyzer to see if you are getting clock or any data output as a response to your commands.

    Regards, Andreas