Communicating with spi with slave in interrupt, the system will be dumped
Posted: Fri Jan 29, 2021 6:06 am
Hi everybody,
I have a problem and hope recive support from everyone.
I am trying to do spi communication with external flash memory (MT25QL128) in interrupt, this leads to the system dump. I want to ask if this is possible? If possible please give me an instruction
Below is my spi communication function:
void spiTranfer(uint8_t *writeData , uint32_t length, uint8_t *readData)
{
//Transaction descriptors. Declared static so they're not allocated on the stack; we need this memory even when this
//function is finished because the SPI driver needs access to it even while we're already calculating the next line.
static spi_transaction_t trans;
//In theory, it's better to initialize trans and data only once and hang on to the initialized
//variables. We allocate them on the stack, so we need to re-init them each call.
memset(&trans, 0, sizeof(spi_transaction_t));
//Odd transfers are data
trans.length = length*8;
trans.user = (void *)1;
trans.tx_buffer = writeData; //finally send the line data
trans.rx_buffer = readData;
trans.flags = 0; //undo SPI_TRANS_USE_TXDATA flag
//Queue all transactions.
spi_device_queue_trans(g_spi, &trans, portMAX_DELAY);
}
Thank you for your time.
I have a problem and hope recive support from everyone.
I am trying to do spi communication with external flash memory (MT25QL128) in interrupt, this leads to the system dump. I want to ask if this is possible? If possible please give me an instruction
Below is my spi communication function:
void spiTranfer(uint8_t *writeData , uint32_t length, uint8_t *readData)
{
//Transaction descriptors. Declared static so they're not allocated on the stack; we need this memory even when this
//function is finished because the SPI driver needs access to it even while we're already calculating the next line.
static spi_transaction_t trans;
//In theory, it's better to initialize trans and data only once and hang on to the initialized
//variables. We allocate them on the stack, so we need to re-init them each call.
memset(&trans, 0, sizeof(spi_transaction_t));
//Odd transfers are data
trans.length = length*8;
trans.user = (void *)1;
trans.tx_buffer = writeData; //finally send the line data
trans.rx_buffer = readData;
trans.flags = 0; //undo SPI_TRANS_USE_TXDATA flag
//Queue all transactions.
spi_device_queue_trans(g_spi, &trans, portMAX_DELAY);
}
Thank you for your time.