View previous topic :: View next topic |
Author |
Message |
maxime33370
Joined: 07 Apr 2015 Posts: 2
|
SPI synchronization between PIC32 and PIC24F |
Posted: Tue Apr 07, 2015 10:28 am |
|
|
Hello,
I've 2 boards, one with PIC32 (Motherboard) and one with PIC24F (Daughterboard) plugged on it. I make current acquisition with ADC on PIC24F and I must send my ADC values to PIC32 with SPI communication. So PIC32 is the master and PIC24F is the slave (I have this configuration because, normally, I have 4 Daughterboards plugged on Motherboard, so Motherboard must choose the right board to communicate).
I have a problem, I think my communication is not synchronized. For example, I send these values with PIC24F to PIC32: 20->19->18 ... ->1. I have an image to illustrate: https://imageshack.com/i/ipn3aoD9p
So, the first time i call the function it works, but after my values are shifted, I don't understand why. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 07, 2015 12:32 pm |
|
|
Synchronize by using the same SPI mode and by using Slave Select. |
|
|
maxime33370
Joined: 07 Apr 2015 Posts: 2
|
|
Posted: Tue Apr 07, 2015 1:04 pm |
|
|
Yes I have already the same SPI mode for both : CKP = 0 and CKE = 0.
But what do you mean when you say "using slave select" because for now i'm using just one slave. So, firstly I select the Slave, then i send my values from Slave to Master and i deselect the slave when all values are sent and received. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Tue Apr 07, 2015 2:04 pm |
|
|
'slave select' is a connection from the 'master' to the 'slave'.
It allows the master to select which slave it want to send/receive data from.
This should be explained in the MSSP section of the datasheets. It is 'seen' by the slave as a 'I need data.....get ready to send' type signal.
hth
jay |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 07, 2015 2:08 pm |
|
|
I think your post is off-topic for this forum. Here's your post on the Microchip forum:
http://www.microchip.com/forums/m855725.aspx
CCS doesn't have a PIC32 compiler, and your PIC24 slave code is
done in a style that is not CCS. |
|
|
|