Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
I posted my error in old resolved thread, but it seems that resolved issues are not well looked at that much, so therefore I create a new one:
I am porting a STM32 application (without RTOS) to a CC3220 with TI-RTOS.
The code first does some SPI write operations to setup a transceiver correctly. After setup, I want to send a TX frame with SPI to the transceiver, but with SPI_transfer() I get an runtime error.
The TX frame is a bit larger than the previously done setup SPI writes (max 9 bytes for setup, the one that is fails 17 for TX frame)
I get the following data from the ROV:
HWI Exception:
BIOS Errors:
Hwi Detailed view:
In this case I only want to write something to the device (because the device does not sent anything back in this case), so no RX buffer is initialized.
I use a global SPI TX buffer (which should be more than enough: SPI_BUFFER_LENGTH = 4224 bytes) and global SPI Transaction variable. All values in the buffer are reset and then set by the header and body buffers that I pass in the function (code below):
int writetospi(uint16_t headerLength,
const uint8_t *headerBuffer,
uint32_t bodyLength,
const uint8_t *bodyBuffer)
{
/* Initialize master SPI transaction structure, and concatenate header and body buffers */
memset((uint8_t *) masterTxBuffer, 0, SPI_BUFFER_LENGTH);
memcpy((uint8_t*) masterTxBuffer , (uint8_t*)headerBuffer, headerLength);
memcpy((uint8_t*) &masterTxBuffer[headerLength] , (uint8_t*)bodyBuffer, bodyLength);
transaction.count = (uint32_t) headerLength + bodyLength;
transaction.txBuf = (void *) masterTxBuffer;
/**< Put chip select line low */
GPIO_write(CS_GPIO, GPIO_PIN_RESET);
/* Perform SPI transfer of header */
bool transferOK = SPI_transfer(spi, &transaction); /* Send header in polling mode */
if (!transferOK) {
Display_printf(displaySerialPC, 0, 0, "Unsuccessful SPI transfer");
}
/**< Put chip select line high */
GPIO_write(CS_GPIO, GPIO_PIN_SET);
I simply don't understand what is going wrong. If I check the signal with oscilloscope then all 18 bytes are send correctly (I can decode them with scope correctly), and even the SPI_Transaction status says SPI_TRANSFER_COMPLETED.
What I do see on the scope, is that the the GPIO_write function is never executed and that the CS stays low. From the debugging session I can also confirm that the transferOK part is never reached.
Could you guys help me a bit how this could happen? According to the documentation the SPI_Transaction does not require an initialized RX buffer, but it does state a warning:
* @warning The use of NULL as a sentinel txBuf or rxBuf value to determine
* whether the SPI transaction includes a tx or rx component implies
* that it is not possible to perform a transmit or receive transfer
* directly from/to a buffer with a base address of 0x00000000. To support
* this rare use-case, the application will have to manually copy the
* contents of location 0x00000000 to/from a temporary buffer before/after
* the tx/rx SPI transaction.
I also checked with RX buffer, but problem does not seem to be solved. Am I missing something very obvious? ROV does not give me any more information either.
Thanks in advance!
MJ