Stm8s spi fill duplex master multi-byte transfers
Hi,
I have been trying to interface stm8s003k3 with and external ic using spi in full duplex master mode .I have been successful to set up the spi in full duplex master mode but the part where recieving and transfering data becomes tricky and I have partially been able to get some data but I think it is wrong.

the second third images are a bit confusing
And this are the waveforms for the reading and writing are as follows
writing is as follows-1 byte of command followed by 3 bytes of data
Reading as follows-1 byte of register read address followed by recieving 3 bytes of data.
I am confused at this point as the rx and tx buffer are not directly accessible but via spi dr register ,when to check flag and is flag cleared and controlled by hardware ... so can I get help on this transmission? I program in C using stvd .Means I have referred to st's examples but I don't think they would help.
Thank you in advance.
