CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

SPI synchronization between PIC32 and PIC24F

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
maxime33370



Joined: 07 Apr 2015
Posts: 2

View user's profile Send private message

SPI synchronization between PIC32 and PIC24F
PostPosted: Tue Apr 07, 2015 10:28 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Apr 07, 2015 12:32 pm     Reply with quote

Synchronize by using the same SPI mode and by using Slave Select.
maxime33370



Joined: 07 Apr 2015
Posts: 2

View user's profile Send private message

PostPosted: Tue Apr 07, 2015 1:04 pm     Reply with quote

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: 9249
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Apr 07, 2015 2:04 pm     Reply with quote

'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

View user's profile Send private message

PostPosted: Tue Apr 07, 2015 2:08 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group