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

Starting out with SPI

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



Joined: 26 Feb 2014
Posts: 24

View user's profile Send private message

Starting out with SPI
PostPosted: Wed Oct 01, 2014 6:28 am     Reply with quote

Hi All

I am about to delve into interfacing a memory chip and ADC via SPI.

The memory chip is a 25LC1024 and the ADC is MCP3550 and both on data lines to a PIC18F4620 hardware spi port.

While I understand the concept and have designed a PCB based on my understanding it would be nice to know of some libraries or links to some examples to get my teeth into.

If interested circuit snippet circuit snippet.

Cheers
Alex
_________________
I type therefore I press buttons
Ttelmah



Joined: 11 Mar 2010
Posts: 19480

View user's profile Send private message

PostPosted: Wed Oct 01, 2014 7:10 am     Reply with quote

Look at this thread:
<http://www.ccsinfo.com/forum/viewtopic.php?t=50261&highlight=24lc1024>

and particularly at the example at the end from RF_Developer. This gives the core of what is needed for every transaction to this chip, and in general 'how to do it'.
temtronic



Joined: 01 Jul 2010
Posts: 9216
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Oct 01, 2014 7:12 am     Reply with quote

Well the first problem is the PIC you've chosen! It will NOT run at 3.3Volts. Check the datasheet, figure 26.1, page 324 and you'll see it's a '5 volt' device.
You have several options to correct this
1) choose a 3 volt PIC. Allows SIMPLE interfacing to 3 volt peripherals
2) add logic level translation devices between 5 volt PIC and 3 volt peripherals.

#1 is probably the best choice as it's simpler, easier to make, less parts, cheaper and faster.


2nd. Have to ask WHY the external ADC when the PIC has a nice builtin peripheral? Getting any ADC to be stable is tricky, 12 bits is challenging and 16 bits will really test your skills!!


hth
jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19480

View user's profile Send private message

PostPosted: Wed Oct 01, 2014 8:21 am     Reply with quote

I'm betting it's the 'look at the data sheet, and not realise that the sheet is for multiple devices' syndrome.

The 18LF4620, is also covered in the same sheet, and will run at up to 25MHz off 3.3v. The 'L' is the critical letter here.....
alyeomans



Joined: 26 Feb 2014
Posts: 24

View user's profile Send private message

PostPosted: Wed Oct 01, 2014 2:19 pm     Reply with quote

Thanks for the reply. I'll check those links Ttlemah.

Temtronic I'd easily be in trouble but the 3.3v does run on the chip I have the L variety. We have other projects at 3.3v which is why the chip is available to me.

The system is 3.3 volts as it can run from either external DC or from a lithium ion battery. The internal ADC is only 10 bits which is not enough 16 bits will do so I would either average the last bits or drop them off pending the results. The circuit has an inductor and cap on power supply as well with good filtering on power.

Cheers
Al
_________________
I type therefore I press buttons
temtronic



Joined: 01 Jul 2010
Posts: 9216
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Oct 01, 2014 3:18 pm     Reply with quote

Good to hear you're using the L version ! You should edit your schematic though as it's the only reference we have to your project.
Be aware that getting 16 bit data is very, very difficult as you need PERFECT PCB layout, signal conditioning, very stable power supply and a solid Vref for the ADC section. Often you will get better results using the builtin 10 bit ADC and using 'Olympic' sampling. 12 bit ADC is tricky, 16 bit is a HUGE challenge.
You could easily spend a month or more 'getting it almost right' with 16 bits ....or have a product ready in just a couple of days using 10 bits.

food for thought

jay
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