November 08, 2024, 02:41:17 PM

microSD cardslot on Pinquino micro

Started by ClassX, February 16, 2013, 03:45:00 PM

Previous topic - Next topic

ClassX

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?

LubOlimex

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

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

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

ClassX

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...

LubOlimex

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
Technical support and documentation manager at Olimex

Embedded

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..