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.

Compiler/EK-TM4C123GXL: EK-TM4C123GXL slave raspberry pi master

Part Number: EK-TM4C123GXL
Other Parts Discussed in Thread: ENERGIA

Tool/software: TI C/C++ Compiler

Iam trying to use TIvia c series as a slave in spi communication. 

I have raspberry pi sending data. What I want to do is to enable ssi on Tivia c series and send the data back to raspberry pi as an acknowledgment. Iam very new to programming any little advise will help. Iam using energia to program my board. 

All i want i s a code that will allow the tivia to recieve data from raspberry pi and send that data back to raspberry pi. 

Thank you very much in advance!

  • Sorry, I am no help with energia. Perhaps someone else in the community can help with that environment. There are functions in the TivaWare library to configure and use the SPI. I am more familiar with the Code Composer Studio environment.

  • Mohammad Siddiqui said:
    ...Raspberry pi sending SPI data ... Receive it on TM4C ... send the data back as an acknowledgment.

    As the data (originates) from the Raspberrry pi - and is (simply) received by TM4C - what is the "value" of (only) an acknowledgement?    (clearly there must be more "requirement" placed upon the TM4C - and that's unspecified in your writing.)

    Like your vendor responder - I'm no energia user - have you read/reviewed energia's data & forum for SPI insight/guidance?

    Usually - new users enjoy greater success w/UART as the, "MCU to MCU" communication medium.    (it's simpler and avoids the "slave-master" complication)    Also I'd suspect that there are more UART examples than SPI ones - perhaps "switch to UART" will speed & ease your task.

    Note too - that as you report being, "Very new to programming" your (forced) choice of "SPI-Slave for the TM4C" (as the RPi serves as SPI Master)  notably raises the, "Degree of difficulty."    (I'd doubt that energia would delve into such slave settings - yet that discovery rests w/you - and stands "unreported.")    

    Beyond: a) ease of programming, b) far greater availability of multiple code examples - use of UART (rather than SPI) opens the possibility of "great separation distance" (easily 100 meters) between the RPi & TM4C.    (such would require an RS232 level shifter to be installed @ each end of your communication link)    (SPI separation usually "maxes out" at/around 200mm for normal SPI data rates.)

    You've not detailed your desire for SPI - yet the case for "UART" appears to offer substantial operational & developmental benefits...   (one suspects that UART is "All that you (really) need.)

  • Bob can you provide me with a code that would receive information on MISO and than send that information on MOSI on CCS. I have the code for Rasp pi and it is doing what it needs to do . I just need to recieve that information on my TM4cunit and send it out back to rasp pi. Any help would be appreciated.

    Thank you,
  • Would you please clarify which device is the master. In the heading you list TM4C123 as the slave and raspberry PI as the master. If that is the case, don't you want code for the TM4C that will receive data on MOSI and send data on MISO? Also I need to know the phase and polarity of the SPI communication. For example, inactive clock level is low, data comes out on rising edge of clock and is captured on falling edge (there are four possible such combinations). I need to know how many bits are in each transfer. I also need to know if you use a chip select and the timing of the chip select from the raspberry PI.
  • Bob thank you for responding. The cod for Raspberry pi works. And it is the master. My goal here is to send the data out from rasp pi and receive it back from the TIVA chip. Following is the code that I'm using on Raspberry pi.

    import spidev
    import time
    spi = spidev.SpiDev()
    spi.open(0, 1)
    try:
    while True:
    resp = spi.xfer2([0xAA])
    time.sleep(0.1)
    #end while
  • Again, I do not know Raspberry Pi, and that code does not clarify it for me. To communicate by SPI you need to know the relationship between clock and data (data out on rising or falling edge of clock, first clock edge is rising or falling) there are four different possibilities. You also need to know how many bits are in each transfer (8 is common, but the TM4C can do 4 to 16). And finally are you connecting with a chip select from master to slave (FSS) and what is the behavior if yes. The four common formats are shown in figures  15-4, 15-6, 15-7 and 15-9 of the TM4C123GH6PM datasheet.