Spi bus multitasking

Uint64_t
Posts: 7
Joined: Sat Feb 25, 2023 11:52 am

Spi bus multitasking

Postby Uint64_t » Tue Feb 28, 2023 10:00 pm

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.

Who is online

Users browsing this forum: No registered users and 104 guests