Page 1 of 1

Spi bus multitasking

Posted: Tue Feb 28, 2023 10:00 pm
by Uint64_t
Task1
Mutex on
t.length=128*8;
t.tx_buffer=sendbuf;
t.rx_buffer=recvbuf;
ret=spi_slave_transmit(RCV_HOST, &t, portMAX_DELAY);
Mutex off
Task2
tg.length=128*8;
tg.tx_buffer=sendbuf;
tg.rx_buffer=recvbuf;
ret=spi_slave_transmit(RCV_HOST, &tg, portMAX_DELAY);

Attention question. Why if I send from any of the tasks, two senbufs will be sent at once: t.tx_buffer=sendbuf and tg.tx_buffer=sendbuf?
I need the second task to only accept data from the master, while the first task only sends data to the master. In this code, it turns out that any function sends double buffers from both tasks, which is incorrect work.