I have been trying to get SPI0 up and running with my beaglebone. I have tried to follow the list in the StarterWare userguide (02_00_00_06 page 121-122). However i can't complete the first three steps, as these functions are not described in the API help. Do you know any workaround, or are these functions not a part of the API?
The first three steps (where i am failing) according to the StarterWare userguide.
Below is my SPI 0 init code so far:
void SPIinit(){ /* * Clocks for McSPI peripheral are enabled using the function McSPI0ModuleClkConfig() */ // Not ready /* * Pin muxing for SPI_CLK, SPI_D0, SPI_D1 pins can be done by calling the function McSPIPinMuxSetup() */
// Not ready /* * Pin muxing for chip select(CS) is done by using the function McSPI0CSPinMuxSetup() */ // Not ready /* * McSPI is placed in local reset state by using McSPIReset() API */ McSPIReset(SOC_SPI_0_REGS); /* *McSPI can be configured in 4-pin mode(CLK, D0, D1, CS) by using McSPICSEnable() API */ McSPICSEnable(SOC_SPI_0_REGS); /* * McSPI is enabled in Master mode of operation using the McSPIMasterModeEnable() API */ McSPIMasterModeEnable(SOC_SPI_0_REGS); /* * To configure Single/Multi channel mode, transmit/receive modes and settings for IS, DPE0, DPE1 can be done by * using the McSPIMasterModeConfig() API. The settings for IS, DPE0 and DPE1 will configure the direction for * SPID0 and SPID1 pins as input or output. Please refer to the schematics to verify the SPI data pin connections * and do the setting accordingly. This API will return “FALSE” if an invalid configuration is done for IS,DPE0 and * DPE1 pins which the McSPI controller cannot process. */ McSPIMasterModeConfig(SOC_SPI_0_REGS,MCSPI_MULTI_CH, MCSPI_TX_RX_MODE, MCSPI_DATA_LINE_COMM_MODE_0, MCSPI_CHANNEL_0 ); /* McSPI clock configuration is done using the McSPIClkConfig() API. Granularity settings of 1 clock cycle or 2^n clock cycles can be done in this API. Also phase and polarity of McSPI clock can be configured here. */ McSPIClkConfig(SOC_SPI_0_REGS, 48000000, 6000000, MCSPI_CHANNEL_0, MCSPI_CLK_MODE_0 ); /* *McSPI word length is configured using the McSPIWordLengthSet() API */ McSPIWordLengthSet(SOC_SPI_0_REGS,MCSPI_WORD_LENGTH(8),MCSPI_CHANNEL_0); /* * Enable the required McSPI channel by using the McSPIChannelEnable() API. Once this API is called McSPI can * generate interrupts depending on the setting. */ McSPIChannelEnable(SOC_SPI_0_REGS,MCSPI_CHANNEL_0);}
Hi Bogi
The functions McSPI0ModuleClkConfig(), McSPIPinMuxSetup() and McSPI0CSPinMuxSetup() can be found in the platform folder of StarterWare package.
However McSPI is not demonstrated(via sample example application) on beaglebone since SPI-Flash is not present on the beaglebone. However you could enable clocks and perform pin-mux by using the above mentioned functions used for EVM(Evaluation module which has SPI-Flash on it).
You could find the McSPI platform file at this location "AM335X_StarterWare_02_00_00_06\platform\evmAM335x\mcspi.c"
Regards
Jeethan
Hello Jeethan
Thank you very much for you help. I found the functions in the library for the evmAM335x and i am now getting data from my TI ADS1274.
Do you know why the SPI module forces very long pauses between each read? Looking at the oscilloscope it seems as if the MOSI line slowly "charges" up to the high level when done transmitting the last bit.
Can you post a new thread with your query? Because this thread/post is already marked "Answered" and hence it may not get the right attention!
Also being from the software team we are not quite aware of the behaviour you are seeing. Hence we request you to post your query in the "AM335x Cortex A8 Microprocessors forum"
Link for the above forum: http://e2e.ti.com/support/dsp/sitara_arm174_microprocessors/f/791.aspx
Regards,