We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi! I am trying to communicate two LPC2214 using SPI, For this I am making One LPC 2214 Master and Transmitting Data using SPI1 and the other LPC is Slave and reciving data using SPI0 Port. Initially for few seconds I am reciving correct data but then data starts corrupting, Why? If I use same SPI port at Both end It is working fine. I have initialized both SPI as said in the data sheet for Master Slave communication. Please Help me! I am in deep trouble now I have almost finalised my hardware and kept these two port free for communication.
Have you checked if your corrupted data is a single bit off or a single byte off?
If you have noise on the clock line, the slave may tick too few or many steps in the data transfer. Because of this, it is important that you make sure that your solution has a way of synchronize in case they get out of sync. You may use the slave select to reset the slave or you may add magic patterns in the data to let the software detect any bit shifts.
Another thing to care about is interrupt response times. Have you made sure that the slave is fast enough responding to any interrupts, since it has no way of controlling the speed of the transfer. If it fails to pick up received data fast enough, you will get an overrun.
Thanks alot Per for replying!! Actually this thing works fine If I used same SPI port at the both end(Master/Slave). But when I am trying to connect SPI1 to SPI0 then the problem arises. So is that both these ports are having Incompatibility.
Are you prioritizing any interrupts?
Yeah! I am using Two interrupts in this code one is for timer0 and other one for SPI data reception. I am giving the highest priority to the Timer Interrupt.
hi,
Some tie before i was doing the same thing using the Microchip IC ,I also face the same kind of problem. i was able solved it through the clck sycronization .Because in my application the the data sycronization is lost after 6-10 literations.
I think it will help ful for you if you check the CLOCK vs DATA syacronization for the reception part
Thanks, Paul
Did I understand you correct that you are saying to check that the slave is configured with the same clock phase as the master, so that it samples the data in the middle of the bits?
Hi! In SPI Master Deciedes the clock of Slave? So I havent Configured Slave clock Do I need to?
You have to tell the slave if it is expected to sample the data on the rising or falling edge of the clock.
If the slave samples on the wrong edge, it is only variances in the delay times for the data and clock signals that MAY let the slave pick up any valid data. But that depends on how much delay times you have in the signal lines compared to the settle times etc.