Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MLA fileio library in mplab for PIC24FJ128GA106 with XC16 compiler

Status
Not open for further replies.

yogeshnand

Newbie level 4
Joined
Dec 22, 2016
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
83
hi everyone,
i am new to PIC24 controller and most PIC24 has PPS configuration. in PIC24Fj128Ga106 i have done UART, I2C, interrupt and now now i want to sd card with PIC24Fj1328Ga106 by using SPI which is PPS configurable. for that i installed MLA and peripheral library. but i have some point that confuse me.
MLA fileio library provides SD card interface which is SPI based. but SPI is PPS configurable.
where it is declare in fileio library example so that i can used for my project. or if library not based on PPS then where is SDI, SDO, SCK pin configuration please provides me some hint so that i can get understand.

thanks
yogesh
 

Without looking at the library code, you can set the PPS up anywhere before you actually use the SPI peripheral. I would suggest somewhere right up front, perhaps around where you set up the oscillator.
If you are using a UART, then you will be setting the PPS registers for that. Same for the external interrupts. Perhaps you should set the PPS register for SPI where you do the other PPS settings.
One thing to check: if you have other PPS settings then either don't use the PPS unlock/lock sequences (the PPS registers are unlocked by default at POR) or make sure the IOL1WAY config bit is clear so you can unlock the PPS registers multiple times.
Susan
 
ohh... i done PPS configuration and checked on proteus oscilloscope and its working. but what if i want to interface two sd card, is there any facility in fileio library. (FILEIO_Write1, FILEIO_Write2...). can i check this simulation in proteus like virtual memory card/SPI interface. because fileio library uses write protection , chip seelct and card detect pin which is not available in MMC model. is there another library other than MLA fileio for sd card interface.
thanking you.
 

(Personal comment: I don't trust any simulator as they can simply be adding another layer of bugs over my own code. I always use real devices.)
Looking at the pins on an SD card, the interface is a simple SPI one (allowing for single, dual and quad SPI interfaces as appropriate but it always starts as a single SPI interface). You can create a multi-slave situation with a single SPI master by driving the required \CS\ pin low (on the assumption that all of the slaves correctly tri-state their MISO pins when they are not selected). As the PIC SPI hardware does not drive the \CS\ pins in master mode you can simply select which SD card you are talking to at any time in your code.
Generally MLA code uses a set of #define directives to set which pins are used for which signals. If you have multiple interfaces then perhaps you need to add a variable that is set to which interface is to be used, and then change all of the code references for the #define signals to 'switch' (or if/else) statements according to the variables value. This will include the\CS\ pin and the 'card detect' and other signals.
Susan
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top