How to send DATA from Slave to Master over SPI
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-11-17 7:12 AM
Posted on November 17, 2014 at 16:12
Hey guys
I'm think to send data from Slave to Master over SPI but there is a problem. when I send the dummy data on SPI lines for create clock on SCK line for Slave, How can I send the data from slave to Maser when the clock is coming? How the SPI peripheral can know the clock is coming and it should send the data? I'm working with my STM32F103RET6 #stm32f103 #spi #spi-slave-mode
Labels:
- Labels:
-
SPI
-
STM32F1 Series
This discussion is locked. Please start a new topic to ask your question.
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-11-17 7:42 AM
Posted on November 17, 2014 at 16:42
a) You'd watch the -CS signal going low
b) Look for RXNE interrupts
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-11-17 8:06 AM
Posted on November 17, 2014 at 17:06
Oh man, Sorry but are you sure? for example look this picture:
http://www.uploadax.com/images/27061574157374718625.jpg page 684, reference manual. as you can see RXNE is set after the received data, thus it means the clocks is over! then we cannot send anythings! can we?Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-11-17 8:17 AM
Posted on November 17, 2014 at 17:17
Well that would be why
a) You look at the -CS and stuff the TX register, I'd expect TXE to be true all the time prior to the first byte/word so not initially helpful. b) SPI slaves often have 8 to 16-bit of slack data sent to them so they can recognize a command being send and respond to it in the next clocking window. Bit hard to predict the future until it gets here.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-11-17 8:32 AM
Posted on November 17, 2014 at 17:32
Thanks clive
Do you have a Master and Slave program to send the data from Slave to Master? I want to know how does it work exactly?Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-11-17 8:53 AM
Posted on November 17, 2014 at 17:53
Not that I can share.
But, I'd recommend looking at the documentation for SPI EEPROM and FLASH devices, and example code in the libraries and utilities directories. Ponder how you might spoof such devices as a slave, and why things like the command and address have to go out before the slave can read the data and respond. Perhaps STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Examples\SPI\FullDuplex_SoftNSS Look at some EXTI examples for catching a falling edge
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
