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

#use spi, selecting baud mode and slave select logic

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



Joined: 13 Jan 2007
Posts: 91

View user's profile Send private message Visit poster's website

#use spi, selecting baud mode and slave select logic
PostPosted: Fri Apr 19, 2013 1:28 pm     Reply with quote

A SPI slave I am using (a FRAM device) requires me to hold the SS line low for multiple bytes in the same transaction (the first byte in a transaction is the command byte followed by context dependent bytes)

I would like to use a SPI clock frequency of 1MHz. The master is a PIC16F877A @20Mhz HS. The hardware SPI peripheral is unavailable.

My current soft SPI code looks like this:

Code:
#define FRAMSD_PIN_SELECT PIN_D0
#use spi(STREAM=SPI2, MASTER, bits=8, mode=3, DI=PIN_D3, DO=PIN_D2, CLK=PIN_D1)


1. What value of 'BAUD' should I select so that the SPI clock frequency is 1MHz? 1000000?

2. Also, is there a way to have the following hold the SS line low for multiple bytes in the same transaction or do I have to handle the ENABLE pin myself manually?

Code:
#use spi(STREAM=SPI2, MASTER, bits=8, mode=3, ENABLE=FRAMSD_PIN_SELECT, ENABLE_ACTIVE=0, DI=PIN_D3, DO=PIN_D2, CLK=PIN_D1, BAUD=<1MHz>)
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