PROCESSOR-SDK-AM68A: Unable to Get Response from SPI Communication on AM68a with SX1262

Part Number: PROCESSOR-SDK-AM68A
Other Parts Discussed in Thread: AM68A

Tool/software:

I am working with the AM68a TI processor and trying to communicate with the SX1262 LoRa module using SPI. While I can send commands via SPI, I am not receiving the expected responses. I’ve followed the necessary steps to set up SPI communication but am encountering issues with getting valid data from the module.

Hardware Setup:

  • AM68a Processor
  • SX1262 LoRa Module
  • Using SPI for communication, with chip select (CS) and busy (BUSY) pins configured as per the hardware documentation.

Software Setup:

  • Python spidev library for SPI communication.
  • SPI device /dev/spidev0.0 detected, but I am unable to get a valid response from the SX1262 module.
  • I’ve attempted to reset the module and wake it up using SPI commands, but the responses remain incorrect or empty.

Observations:

  1. The SPI device is present (/dev/spidev0.0), but the spidev kernel module is not loaded, as indicated by the following:

    • lsmod | grep spidev returned no results.
    • When attempting to load the spidev module using modprobe spidev, I received the error: FATAL: Module spidev not found in directory /lib/modules/6.1.80-dirty.
  2. The permissions for the SPI device are restricted to the root user (crw-------), and I am currently accessing it using root.

  3. The response from the module is consistently 0x00 (empty data), which is not expected. The logic analyzer shows data being sent correctly, but the responses from the device are incorrect.

Questions:

  1. How do I ensure that the spidev module is available and properly loaded on my AM68a platform? It seems like the module is missing, but I would appreciate confirmation on how to properly enable it or rebuild the kernel if needed.
  2. Is there a specific configuration or initialization step I might be missing to properly communicate with the SX1262 using SPI?
  3. Are there any additional diagnostic steps I can take to isolate the issue with the SPI communication?
  • Hello,

    Most of the team members are out of office. Please expect delayed response.

    - Keerthy

  • Thank you Keerthy,

  • I wanted to clarify some observations based on further testing of the SPI communication issue in the AM68a processor.

    • The data is being sent from the MISO pin (pin 21), not the MOSI pin (pin 19), which is the main issue. The MOSI pin does not send the expected data, while MISO is showing the transmitted data.
    • The logic analyzer confirms that data is being sent correctly, but it’s appearing on the wrong pin (MISO) instead of MOSI.

    I have futher tested with sample python code.

    Test Setup:

    • MOSI (pin 19) and MISO (pin 21) are connected to the logic analyzer.
    • I sent some test data ([0x48, 0x65, 0x6C, 0x6C, 0x6F] which corresponds to "Hello").
    • The Python spidev library was used, and SPI was set to mode 0 with a speed of 50 kHz.
    • import spidev
      import time
      
      # SPI device parameters
      SPI_BUS = 0         
      SPI_DEVICE = 0      
      SPI_MODE = 0        
      SPI_SPEED_HZ = 50000 
      
      # Create an SPI object
      spi = spidev.SpiDev()
      
      def setup_spi():
          """
          Initialize the SPI interface.
          """
          # Open SPI bus and device
          spi.open(SPI_BUS, SPI_DEVICE)
          spi.mode = SPI_MODE
          spi.max_speed_hz = SPI_SPEED_HZ
          print(f"SPI initialized: Bus={SPI_BUS}, Device={SPI_DEVICE}, Mode={SPI_MODE}, Speed={SPI_SPEED_HZ} Hz")
      
      def send_and_receive(data):
          print(f"Sending: {data}")
          response = spi.xfer2(data)  # Transfer data
          print(f"Received: {response}")
          return response
      
      def main():
          try:
              setup_spi()
      
              while True:
                  # Test data to send
                  test_data = [0x48, 0x65, 0x6C, 0x6C, 0x6F]  # ASCII for "Hello"
      
                  response = send_and_receive(test_data)
      
                  try:
                      decoded_response = ''.join(chr(byte) for byte in response if 32 <= byte <= 126)
                      print(f"Decoded Response: {decoded_response}")
                  except Exception as e:
                      print(f"Error decoding response: {e}")
      
                  # Wait before sending the next transaction
                  time.sleep(1)
      
          except KeyboardInterrupt:
              print("\nExiting...")
          finally:
              spi.close()
              print("SPI closed.")
      
      if __name__ == "__main__":
          main()
      

    Results:

    • The data is being successfully sent from the SPI bus.
    • However, the data is coming from the MISO pin (pin 21), not the MOSI pin (pin 19) as expected. The MISO pin shows the correct data, but MOSI stays idle.
    • The logic analyzer confirmed this: MISO is sending the data, but MOSI is not.

    Questions:

    1. Is there a pin configuration issue on the AM68a that could cause the MISO and MOSI pins to behave this way?
    2. Are there any additional debugging steps I can try to resolve this issue?

    Thanks in advance for any help!

  • Hi,

    It has been over two weeks since I raised this query on the SPI communication issue in the AM68a processor. I would appreciate a response to clarify the unexpected behavior observed with the MISO and MOSI pins as outlined in my earlier post.