MMC_Fat_16 library and two SPI interfaces

General discussion on mikroPascal PRO for PIC.
Post Reply
Author
Message
Hristo
Posts: 33
Joined: 20 Oct 2014 14:39

MMC_Fat_16 library and two SPI interfaces

#1 Post by Hristo » 23 Mar 2015 20:34

Hello,
I use PIC18F67K2 microcontroller. Can you tell the library MMC_FAT_16 to use a specific SPI interface, provided that use both and initialize both interfaces. SD card is connected to SPI1 and order
Init_SPI2
Init_SPI1
everything works, but can be specified explicitly.
The same applies for the RS485 library when used both UART interface.
Hristo

User avatar
darko.minic
Posts: 747
Joined: 01 Dec 2014 11:10

Re: MMC_Fat_16 library and two SPI interfaces

#2 Post by darko.minic » 24 Mar 2015 10:14

Hi,

If I understand you correctly you can initialize MMC_FAT_16 to use a specific SPI interface:
For example:

Code: Select all

// MMC module connections	
var Mmc_Chip_Select : sbit at RC0_bit;
var Mmc_Chip_Select_Direction : sbit at TRISC0_bit;
// MMC module connections

error = Mmc_Init();  // Init with CS line at RC.0
var i : byte;
...
SPI1_Init();
i = Mmc_Init();
For more information please refer help from our compiler:
mikroPascal PRO for PIC Libraries > Hardware Libraries > Multi Media Card Library

Regards,
Darko

Hristo
Posts: 33
Joined: 20 Oct 2014 14:39

Re: MMC_Fat_16 library and two SPI interfaces

#3 Post by Hristo » 25 Mar 2015 09:10

Hello Darko,
When you initialize the two SPI interfaces in the following order

Mmc_Chip_Select : sbit at LATB5_bit;
Mmc_Chip_Select_Direction : sbit at TRISB5_bit;

SPI2_Init;
SPI1_Init;

error := MMC_Fat_Init;

everything works normally.

When you initialize the two SPI interfaces in the following order

Mmc_Chip_Select : sbit at LATB5_bit;
Mmc_Chip_Select_Direction : sbit at TRISB5_bit;

SPI1_Init;
SPI2_Init;

error := MMC_Fat_Init;

procedure using predefined MMC_Chip_Select, but trying to work with SPI2.

My question to the developers - can you tell the procedure MMC_Fat_Init which interface to use and it does not depend on the order of initialization of the interfaces.
Please do not propose to read HELP, because there is no such thing.
Best regards,
Hristo

aCkO
Posts: 1119
Joined: 14 Feb 2011 04:07
Location: Bar, Montenegro

Re: MMC_Fat_16 library and two SPI interfaces

#4 Post by aCkO » 25 Mar 2015 09:16

Use SPI_Set_Active before MMC_Fat_Init.

Regards

Hristo
Posts: 33
Joined: 20 Oct 2014 14:39

Re: MMC_Fat_16 library and two SPI interfaces

#5 Post by Hristo » 25 Mar 2015 14:06

Thank you, aCkO
This is OK.

Best regards,
Hristo

Post Reply

Return to “mikroPascal PRO for PIC General”