2017-01-27 02:28 PM
Hi.
I have problem by SPI that is :
When i want to send data for example in slave mode during receiving from master. data will corrupt ( if i just receive data and send to UART it works fine). I think it happens Because both TXE and RXNE occurs at same time and when MCU is in ISR data will rewrite in data register before transfer to Tx/Rx buffer . How can i Handle this in continuous transmission ? . it's my code :
-------------------------------------------------------------------------↓
//Slave Part
void
SPI2_IRQHandler(void
){static char counter =
0x40
;
if
( SPI2->SR & SPI_SR_RXNE ) { sendToUart(SPI2->DR); }if
( SPI2->SR & SPI_SR_TXE ) { SPI2->DR = counter; counter++; if(counter >=0x5B
)counter=0x40
; }}
-------------------------------------------------------------------------↑
Solved! Go to Solution.
2017-01-30 02:27 PM
This is basic textbook stuff (although probably rarely taught on basic digital courses, or easily forgotten/overlooked) rather than ST-specific, that's why it's not mentioned in the DS/RM.
The high frequency content of digital signal depends more on the edges' slew rate than on the repetition frequency. And it's those gigahertzs which are causing all the nasty ringing and reflections which in turn get detected by the rather fast clock circuitry.
Never use a faster digital output than the absolute minimum you need.
JW
2017-05-15 10:16 PM
Hi...
Please can you give me your working SPI Program. (
mailto:jsureshp@gmail.com
)Thank you.....
2017-05-16 12:23 AM
Hi...
Please can you give me your working SPI Program. (
mailto:jsureshp@gmail.com
)Thank you.....