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.

SPI Example for BeagleBone using Starterware



Greetings:

I am using a BeagleBone as a development platform while I am waiting for the fine boards to become available. 

We will be using Starterware to host the application in the final configuration.  I am able to configure and use many of the peripherals by examining the sample code provided.  The McSPI interface has been particularly troublesome as there is no sample code provided for the BeagleBone platform. 

I have spent time looking through the Starterware forums and I haven’t found a complete solution yet.  I found a couple of threads (here and here) that looked promising. Even taken together there seems to be a few gaps in the information.      

To avoid making a long story even longer, I’ll just cut to the chase.  Does anyone out there have a complete solution for either SPI_0 or SPI_1 on the BeagleBone using Starterware? Are there plans to update the Starterware BeagleBone examples to include some rudimentary McSPI examples?   

Respectfully,

Dave

  • Hi David,

    Currently there is not McSPI example support on a Beaglebone. In future we shall have it.

    However we can support you with getting your example working. You can take reference of McSPI code present for EVM AM335x. Can you please give more details like -

    1) Which is the slave device that you are communicating to?

    2) Which McSPI instance are you using.?

    3) Any more details that you can share?

    Regards,

    Jeethan

  • Hello Jeethan:

     Initially, I am targeting an SPI Flash device very similar to the Winbond W25Q64CV device on the EVM daughter card.  Specifically, I am using the Winbond W25Q80BV to develop the initial code on SPI_0 with SPI_0_CS0. 

     The ultimate design will have an LTC2378-18 ADC on SPI_0 with SPI_0_CS0 and an LTC2641-16 DAC on SPI_1 with SPI_1_CS0.  I am using a BeagleBone White card as the host platform for the initial code while I wait for the final cards.

    Respectfully,
    Dave

  • Thanks Dave for the info.

    What is the problem your facing in your code?

    1) Are you using polling/interrupt mechanism or using EDMA to transfer data between McSPI and memory.

    2) If using interrupts, are you able to receive Tx/Rx interrupts

    3) If data is being transmitted/received are you seeing corrupt data?

    Regards,

    Jeethan

  • Hello Again:

    After carefully rereading the other threads listed in my OP I managed to get the Interrupt driven McSPI_Flash demo working on SPI1 with CS0.  My next task is to extend the McSPI_Flash example to interact with FOUR W25Q80BV SPI flash devices on SPI0 CS0 & CS1 and SPI1 CS0 & CS1.

    Can you offer any recommendations for successfully extending this example to interact with four devices?  I am having a hard time wrapping my head around the driver and platform code.  Specifically, the usage of parameters such as SPI Instance and Channel.

    Respectfully,
    Dave

  • Hi David,

    You can incorporate 4 Slave devices using 2 McSPI instances. Each instance has 2 channels/ Chip selects.

    To get your example working you will have to perform -

    1) Configure the McSPI module clock and pinmux for CLK, CS, MOSI, MISO of both the instances. You can take reference from EVM code and do the needful for McSPI instance 1.

    2) Configure McSPI channel 1 or CS1 by taking reference from EVM code which has configuration of SPI0 CS0.

    Regards,

    Jeethan

  • Hello @David Cichy

    I am also using an LTC DAC ( LTC2602) but I am having trouble to send the data correctly. Although when the update frequency is low everything works fine. But when I update the 2 outputs every 50 msecs then things become problematic. 

    So my question is the following:

    Can you tell me how you configured the SPI to send the data to DAC.
    I am particularly interested in the following:

    McSPIMasterModeConfig 
    McSPIClkConfig
    McSPICSPolarityConfig

    Mine are the following:

    /* single channel , tx only , channel zero , and  MCSPI_DATA_LINE_COMM_MODE_1 */
    McSPIMasterModeConfig(SOC_SPI_0_REGS,MCSPI_SINGLE_CH,MCSPI_TX_ONLY_MODE, MCSPI_DATA_LINE_COMM_MODE_1, 0);

    /* Polarity of SPICLK is ZERO and phase also ZERO , set to mode 0 */
    McSPIClkConfig(SOC_SPI_0_REGS, MCSPI_IN_CLK, MCSPI_OUT_FREQ, chan,
    MCSPI_CLK_MODE_0);

    /* Set polarity of SPIEN to low.*/
    McSPICSPolarityConfig(SOC_SPI_0_REGS, MCSPI_CS_POL_LOW, chan);

     Maybe other tips?