Post Go back to editing

ADAR1000 SPI

Thread Summary

The user is seeking example source code to control the ADAR1000 via SPI without using a GUI. The final answer indicates that the code was emailed to the user. Accompanying answers suggest using the provided SPI programming example in the datasheet and adapting a GPIO control function for the ADAR1000, with the CSB pin needing to be controlled correctly. Additional users have requested copies of the code, and one user has shared a GitHub repository with their implementation.
AI Generated Content

 Hello, I am using ADAR1000 but unfortunately, there is no reference source code. I could not find anywhere. Just we have SPI PROGRAMMING EXAMPLE in the Datasheet. I want to make and control the SPI communication protocol without using GUI. Can you provide example source code?

Best Regards.

Parents Reply
  • A few things:

    • You need to clock in the 16 preceding address bits, so you need to change the range function
    • You also need to keep the CSB high, unless you are writing bits to the SPI

    So, I think you'd want to change the tfr_byte2() to something like this (changed in bold):

    def tfr_byte2(data):

        GPIO.output(CSB, false)  #Pull the CSB low to enable the SPI port
        for i in range (0,24):
            GPIO.output(DATA, data & 0x01)
            pulseHigh(W_CLK)
            data=data>>1
        GPIO.output(CSB, true)  #Pull the CSB high to disable the SPI port

         return

    You will need to take care of the CSB-to-GPIO pin number mapping in your code.

    Also, in your initialization code of the GPIO lines, you'll want to start the CSB pulled high with:

    #Initialization Code

    GPIO.output(CSB, true)  #Pull the CSB high to disable the SPI port

    No guarantees that this works, but it should give you a pretty good start.  Hope this helps.

Children