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

PIC24F SPI Communication setup

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



Joined: 23 Jan 2018
Posts: 44

View user's profile Send private message

PIC24F SPI Communication setup
PostPosted: Mon Jul 17, 2023 3:35 am     Reply with quote

Hi,

I am using PIC24FJ512GL406, in one of my project to communicate with a flash chip of winbond over SPI. During the setup of SPI communication using setup_spi function available in device.h file I found there is no parameter for communication speed setup.

Any help regarding that will be very helpful.

Thanks in Advance.
Ttelmah



Joined: 11 Mar 2010
Posts: 19503

View user's profile Send private message

PostPosted: Mon Jul 17, 2023 6:54 am     Reply with quote

Use #USE_SPI, not setup_spi.
setup_spi, is largely deprecated now.
Look also at the top of the forum here in how to use PIN_SELECT. Vital
on modern chips.

However if you must use spi_setup, then the baud goes after the mode
setting. So:
Code:

#PIN_SELECT SCK1OUT=PIN_B0

#PIN_SELECT SDO1=PIN_B1
#PIN_SELECT SDI1=PIN_B2
void main()
{
   setup_spi(SPI_MASTER | SPI_SCK_IDLE_LOW | SPI_XMIT_L_TO_H | SPI_SAMPLE_AT_MIDDLE, 400000);
   //setup for 400Kbps



Obviously with suitable settings for your SPI.
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