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

MMC SPI and UART

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



Joined: 16 Mar 2008
Posts: 27

View user's profile Send private message

MMC SPI and UART
PostPosted: Wed Dec 17, 2008 11:58 pm     Reply with quote

Hello!
Has anyone here benchmarked the MMC over SPI transfer rate when using either FAT 16 or 32 ? Software SPI is quite slow but my application requires me to use the hardware pin for TX ( PIC18F4550) to give priority to the hardware UART. ( Unfortunately Microchip multiplexed the RC7 pin with RX(UART) and SDO(SPI) so I cannot use hardware SPI while using the same pin for hardware UART) I want to use the full UART for MIDI application and utilize software SPI. Will it introduce so much latency in the data transfer? Has someone tried it?
Regards
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: MMC SPI and UART
PostPosted: Thu Dec 18, 2008 12:41 am     Reply with quote

baltazar_aquino wrote:
Hello!
Has anyone here benchmarked the MMC over SPI transfer rate when using either FAT 16 or 32 ? Software SPI is quite slow but my application requires me to use the hardware pin for TX ( PIC18F4550) to give priority to the hardware UART. ( Unfortunately Microchip multiplexed the RC7 pin with RX(UART) and SDO(SPI) so I cannot use hardware SPI while using the same pin for hardware UART) I want to use the full UART for MIDI application and utilize software SPI. Will it introduce so much latency in the data transfer? Has someone tried it?
Regards


No I have not tried it but....

There can be large voltumes of traffic that must traverse the MMC SPI bus when reading or writing. For example assume you have finished with the current sector and need to access the next sector. If the next sector is in a different cluster then you need to perform a directory lookup, a fat lookup, then fetch the sector. Multiple sector fetches could be required at each step. Each sector fetch is 512 bytes (4096 bits).

The CCS software SPI driver will result in the rest of the application waiting on this serialization process. If this is not a problem then it is a simple solution. An alternative approach is to emulate the hardware SPI using a timer and an interrupt handler. This will enable you to treat the emulated SPI in the same way you treat the hardware SPI allowing either blocking or non blocking operation.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
baltazar_aquino



Joined: 16 Mar 2008
Posts: 27

View user's profile Send private message

PostPosted: Thu Dec 18, 2008 7:40 am     Reply with quote

Thanks Andrew. I am just thinking of spending few more dollars for another chip ( a PIC18F2550 perhaps) to perform the MMC controller funtion. This will free the 4550 for other tasks. The application is a MIDI sequencer hence it requires stable timing and I don't want the software SPI to clash with it.
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Dec 18, 2008 9:52 am     Reply with quote

baltazar_aquino wrote:
Thanks Andrew. I am just thinking of spending few more dollars for another chip ( a PIC18F2550 perhaps) to perform the MMC controller funtion. This will free the 4550 for other tasks. The application is a MIDI sequencer hence it requires stable timing and I don't want the software SPI to clash with it.


The emulated SPI driver loading would be insignificant however loading required to support the MMC itself (hardware or emulated SPI) would have to be considered. You would only benefit from using a separate PIC to manage the MMC if the coding for the first PIC used non blocking techniques for reading an/or writing to the second PIC.

If you add another PIC to control the MMC then I suggest using a PIC18F2620 to handle the MMC - the PIC18F4550 family are poor candidates for using for SD/MMC cards if you also want to use the USB because limited RAM available to support SD/MMC card operations. The PIC18F2620 has far more RAM enabling it to manage more simultaneous open files which may not be of interest for this specific project but makes it reusable for other projects. If you were not tied to the PIC18F family for the second PIC then PIC24FJ64GA002 (same physical size as a PIC18F2550) would be a great candidate because it has two SPI busses, remappable I/O lots of RAM, high performance and is cheap.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
baltazar_aquino



Joined: 16 Mar 2008
Posts: 27

View user's profile Send private message

PostPosted: Sun Dec 21, 2008 11:03 am     Reply with quote

sound advice andrew. thanks. Very Happy
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