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.

RTOS/CC1310: SPI Transaction

Part Number: CC1310

Tool/software: TI-RTOS

Hi,

I am using the SPI driver since the beggining of my project to communicate with a external flash memory.

Everything was good until I reach a point where I need to do things very fast.

The SPI communication wasn't working fast enough, so I started investigating why.

I discovered that the bottlenack of the speed was the number of transactions made.

I was reading/writing one byte at a time (function below). So, to write a whole memory page (4096 bytes) I was doing 4096 transactions.

uint8_t spi_send_receive_8bits(SPI_Handle * spiHandle, uint8_t aByte)
{
	uint8_t rxByte;
	uint8_t txByte;

	SPI_Transaction spiTransaction;

	txByte = aByte;

	spiTransaction.count = 1;
	spiTransaction.rxBuf = &rxByte;
	spiTransaction.txBuf = &txByte;

	SPI_transfer(*spiHandle,&spiTransaction);

	return rxByte;
}

I re-write it to read/write 64 bytes at a time. It reduced drastically the time need to read/write the same 4096 bytes. Now I am doing 64 transactions instead of 4096 transactions.

But I need to do it even faster.

My question is: both buffers must be the same size?

I have a rxBuffer that have 4096 bytes.

To read one byte from the external memory I need to send a dummy byte.

I would like to do something like that:

void spi_read_buffer(SPI_Handle * spiHandle, uint8_t * rxBuffer, uint16_t size)
{
  SPI_Transaction spiTransaction;
  
  uint8_t dummyByte = 0x00;

  spiTransaction.count = size;
  spiTransaction.rxBuf = rxBuffer;
  spiTransaction.txBuf = &dummyByte;

  SPI_transfer(*spiHandle, &spiTransaction);
}

Using the same logic, I would like to write a n bytes txBuffer without caring about the returning bytes.

The problem of having two buffers with same size is that I will need to create a second buffer with 4096 bytes. I don't have RAM or FLASH available to do that.

Is there any way do achieve what I would like to do?

Thank you!