Olimex Support Forum

DUINO => PINGUINO => Topic started by: ClassX on February 16, 2013, 03:45:00 PM

Title: microSD cardslot on Pinquino micro
Post by: ClassX on February 16, 2013, 03:45:00 PM
I have a problem initiating microSd cards which are inserted in the Pinquino card slot (using RB13 as CS).
When I connect the microSD card via a seprate socket to the EXT port (using RF0 as CS), I have no problem with the same microSD card. Am I doing something wrong?
Title: Re: microSD cardslot on Pinquino micro
Post by: LubOlimex on February 21, 2013, 09:14:59 AM
Hey ClassX,

The best idea would be to examine the SD card project we have available at the web page of PIC32-PINGUINO-MICRO: https://www.olimex.com/Products/Duino/PIC32/_resources/PINGUINO(-OTG)(-MICRO)+SD_CARD_rev_543.zip (https://www.olimex.com/Products/Duino/PIC32/_resources/PINGUINO(-OTG)(-MICRO)+SD_CARD_rev_543.zip)

Did you also check this wiki article: http://wiki.pinguino.cc/index.php/Category:SD_Library (http://wiki.pinguino.cc/index.php/Category:SD_Library)?

Best regards,
Lub/OLIMEX
Title: Re: microSD cardslot on Pinquino micro
Post by: ClassX on February 22, 2013, 09:56:05 PM
Well, after some long and hard thinking, I found the problem. Apparently, port B13 is by default configured for JTAG. The following code made it possible to use b13 as a digital output and to drive SDCS in the standard way (SDCS = 1 or SDCS = 0).

#include "plib.h"                        // include peripheral library

mJTAGPortEnable(0);                      // Disable JTAG
PORTSetPinsDigitalOut(IOPORT_B, BIT_13); // Configure PORTB B13 as output.

One needs a lot of experience to develop the gut feel to successfully program microcontrolers...
Title: Re: microSD cardslot on Pinquino micro
Post by: LubOlimex on February 26, 2013, 08:43:32 AM
Hey ClassX,

Glad you got it going!

Well, if it  in time, after you've gained some experience, you will start to solve problems quicker.

Best regards,
Lub/OLIMEX
Title: Re: microSD cardslot on Pinquino micro
Post by: Embedded on April 06, 2013, 06:14:19 PM
Thankx ClassX

You just solved my issue with the SD card too. I'm using Mikro C and their bootloader and couldn't figure why it wouldn't talk to the micro SD.

in C:

  JTAGEN_bit = 0;        // Disable JTAG

Here's the pin definition for B13:

// MMC module connections
sbit Mmc_Chip_Select at LATB13_bit;
sbit Mmc_Chip_Select_Direction at TRISB13_bit;

Cheers..