SLAAEJ0 November   2023 AM625 , MSPM0L1306

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
    1. 1.1 SPI Transaction Dataflow
    2. 1.2 AM62x Processor
    3. 1.3 MSPM0L130x Microcontroller
  5. 2Hardware Setup
    1. 2.1 A53 Core Hardware Setup
    2. 2.2 M4F Core Hardware Setup
  6. 3Software Setup
    1. 3.1 Cloning the Beyond SDK GitHub Repository
    2. 3.2 SK-AM62x Software Setup
      1. 3.2.1 A53 Core
      2. 3.2.2 M4F Core
    3. 3.3 LP-MSPM0L130x Software Setup
  7. 4Steps for Execution
    1. 4.1 Run Project on LP-MSPM0L130x
    2. 4.2 Run Project on SK-AM62x
      1. 4.2.1 A53 Core
      2. 4.2.2 M4F Core
  8. 5Results
    1. 5.1 Single Byte Single Channel
    2. 5.2 Single Byte Multi Channel
    3. 5.3 Multi Byte Single Channel
    4. 5.4 Multi Byte Multi Channel
  9. 6Summary
  10. 7References

A53 Core

Inside &main_pmx0{...} add:

main_spi0_pins_default: main-spi0-pins-default { 
        pinctrl-single,pins = <
             AM62X_IOPAD(0x01bc, PIN_OUTPUT, 0) /* (A14) SPI0_CLK */
             AM62X_IOPAD(0x01c0, PIN_INPUT, 0) /* (B13) SPI0_D0 */
             AM62X_IOPAD(0x01c4, PIN_OUTPUT, 0) /* (B14) SPI0_D1 */
             AM62X_IOPAD(0x01b4, PIN_OUTPUT, 0) /* (A13) SPI0_CS0 */ 
        >; 
};

At the end of the file, add:

&main_spi0 { 
     status = "okay"; 
     pinctrl-names = "default"; 
     pinctrl-0 = <&main_spi0_pins_default>; 
     spidev@0 { 
         spi-max-frequency = <16000000>; 
         reg = <0>; 
         compatible = "rohm,dh2228fv"; 
     }; 
}; 
  • Recompile the kernel using the steps given on User Guide - Processor SDK AM62x. While following steps on this page, customize the kernel by using menuconfig as per the Kernel Configuration section provided on SPI Kernel Driver. For more details, see the steps below.

HOST$ cd <psdk-installaion-path>/board-support/ti-linux-kernel/
HOST$ make defconfig ti_arm64_prone.config
HOST$ make ARCH=arm64 menuconfig 
      Device Drivers --->
          [*] SPI support
              <*> User mode SPI device driver support
#Save these changes to the .config file
HOST$ make Image dtbs modules
HOST$ sudo cp ./arch/arm64/boot/Image /media/<USER>/root/boot/
HOST$ sudo cp ./arch/arm64/boot/dts/ti/k3-am625-sk.dtb /media/root/boot/dtb/ti
HOST$ sudo -E env “PATH=$PATH” INSTALL_MOD_PATH=/media/<USER>/root make modules_install
HOST$ sync; sync
  • Copy the target C file to the SDK path and compile the C project file using any method given on Compiling Example Hello World Program. Using either method, you should have an executable file loaded into the SD card in the end. For more details, see the steps below.

HOST$ cd <Beyond-SDK-installation-path>/Beyond-SDK/am62x/MSPM0-ADC-RTC-Attach/MSPM0-ADC-Attach-SPI/<x_Byte_x_Channel_SPI>/Controller/AM62x-A53_Core_MAIN_Domain/
HOST$ cp <target-filename>.c <psdk-installation-path>/linux-devkit/
HOST$ cd <psdk-installation-path>/linux-devkit/
HOST$ source environment-setup
HOST$ ${CC} <target-filename>.c -o <output-filename>
HOST$ sudo cp <output-filename> /media/<USER>/root/home/root
HOST$ exit
  • Insert the SD card back into SK-AM62x and reboot the device.