Other Parts Discussed in Thread: SYSBIOS
F28M35H52C1, ARM, CSS 6.1.2, TI-RTOS, SPITivaDMA.c
I try to read spi from 2 theads. i try read at different times. I made a function to safe access to SPI
const struct SPI_Params paramsSPI =
{
.transferMode = SPI_MODE_BLOCKING,
.transferTimeout = SPI_WAIT_FOREVER,
.transferCallbackFxn = NULL,
.mode = SPI_MASTER,
.bitRate = 1000000, //(Hz)
.dataSize = 8,//(bits)
.frameFormat = SPI_POL0_PHA0,
.custom = NULL
};
bool readW5100(SPIName numW5100, uint8_t *array, int len, int adrInW5100)
{
//взять мьютекс
Semaphore_Handle sem = (numW5100 == SPI_W5100_1) ? semW5100_1 : semW5100_2;
bool isSemPend;
isSemPend = Semaphore_pend(sem, 1000);
assert(isSemPend);
SPI_Handle spiHandler = SPI_open(numW5100, (SPI_Params *)¶msSPI);
if(spiHandler == NULL)
{
System_abort("Error initializing spi");
System_flush();
assert(1);
return false;
}
for(int i = 0; i < len; i++)
array[i] = readByte(spiHandler, adrInW5100++);
SPI_close(spiHandler);
Semaphore_post(sem);
return true;
}
void writeByte(SPI_Handle handler, uint16_t adrReg, uint8_t data)
{
unsigned char txBuffer[5] =
{ 0xf0 };
unsigned char rxBuffer[5];
txBuffer[1] = adrReg >> 8;
txBuffer[2] = adrReg;
txBuffer[3] = data;
SPI_Transaction masterTransaction;
masterTransaction.count = 4;
masterTransaction.rxBuf = (Ptr)rxBuffer;
masterTransaction.txBuf = (Ptr)txBuffer;
SPI_transfer(handler, &masterTransaction);
}
1)When i read SPI from one task, i can see normal transaction. I can see MISO, MOSI, CS, CLK on SPI lines. When i try to read SPI from another task, i can see only MISO, CLK and CS. The MOSI lineю These is low level on MOSI line. Why?
2) I can see calls macros in your spi driver, SPITivaDMA.c
Log_error1("SPI:(%p) transaction still in progress",
hwattrs->baseAddr);
but i can not see this log. Which displays this macro logging?

