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.
Part Number: BEAGLEBK
Tool/software: Linux
I write below instruction to start working with mcspi on beaglebone black.
//Enable SPI0 Clock SPI0_CLK= ON; //Disable Channel MCSPI_CH0CTRL =0x00000000; //set Master Mode MCSPI0_MODULCTRL=0x00000000; //Reset IRQ status and Enable IRQ MCSPI_IRQSTATUS =0x00000000; MCSPI_IRQENABLE =0xFFFFFFFF; //D0 output and D1 input MCSPI_SYST |= 0x00000200; //Config channel0 MCSPI_CH0CONF =0x000607D7; //Start the channel MCSPI_CH0CTRL =0x00000001; //Write in Tx buffer MCSPI_TX0=0xaa; //Check If EOT set. while (((MCSPI_CH0STAT & 0x00000004)>>2) == 0); //Check If RXS set. while ((MCSPI_CH0STAT & 0x00000001) == 0); //Read received data result=MCSPI_RX0; //Disable SPI0 clcok SPI0_CLK = OFF;
also i set below configuration for spi pins in Device Tree:
0x150 0x10 /* spi0_sclk, OUTPUT_PULLUP | MODE0 */ 0x154 0x10 /* spi0_d0, OUTPUT_PULLUP | MODE0 */ 0x158 0x30 /* spi0_d1, InPUT_PULLUP | MODE0 */ 0x15c 0x10 /* spi0_cs0, OUTPUT_PULLUP | MODE0 */
But the data that i read from MCSPI_RX0 register is zero. For testing i connect SPI0_D1 pin to VCC on board, therefore i must get all ones in result but the result is zeros still.
Also i connect SPI0_D0 and SPI0_D1 together on board , therefore i must receive 0xaa on result but it's still zero.
I connect Logic Analyzer to CS0,CLK and SPI0_D0 pins and show the result in below image.
As you can see CLK frequency change during communication and D0 has some invalid data instead of 0xaa , but CS works fine.
What is the problem?