cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

Hi Sir/Madam,

       As a part of my project, I am dealing with the speed control of stepper motor using  TMC260_pa& PSoC 3 controller
While using TMC driver, need to write a function ReadWriteSPI(),can you please help me.

I got ReadWriteSPI() function of AVR

unsigned char ReadWriteSPI(unsigned char Data)
{
SPDR=Data;
while(!(SPSR & 0x80));
return SPDR;
}

It first writes the data that is to be send to the SPI Data Register (one byte). Then it waits until sending and receiving the data is done. Finally it returns the data that has been received by the microcontroller (which in the AVR can be found in the same register).

Thank you!

0 Likes
Reply
1 Solution
himam_31
Employee

Please have a look at the SPI code examples available with PSoC Creator. The API's for writing data and waiting for the data to be sent will be explained in the example project. Also have a look at the SPI component datasheet.

Thanks,

Hima

View solution in original post

0 Likes
Reply
1 Reply
himam_31
Employee

Please have a look at the SPI code examples available with PSoC Creator. The API's for writing data and waiting for the data to be sent will be explained in the example project. Also have a look at the SPI component datasheet.

Thanks,

Hima

View solution in original post

0 Likes
Reply