cancel
Showing results for 
Search instead for 
Did you mean: 

Stm8s spi fill duplex master multi-byte transfers

CClas.1
Associate

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.0693W000008GEWyQAO.jpg0693W000008GEX3QAO.jpg0693W000008GEX8QAO.jpgthe second third images are a bit confusing

And this are the waveforms for the ​reading and writing are as follows0693W000008GEYfQAO.jpg0693W000008GEYaQAO.jpgwriting 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​.

1 REPLY 1
CClas.1
Associate

Well,

after experimenting a bit , I have been able to get some transfer on mosi and miso pins and am seeing some sclk signals after probing.Now after some hard work ,the slave device has started communicating and nevertheless to what it sends,the debugger and the display on which I output the data received always show 0xff and 0x00 , and I tried to send different commands to which the is responds with different data but always receive 0xff and 0x00 and so I am unable to pinpoint the problem.

Please help asap as I am short on time .

I have already interfaced the same ic using software spi by another micro and from my side the protocol is perfect and this is the imported version of my library.