-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SOLVED : SD fat on Software SPI not compiling on MightyCore 1284p #55
Comments
I don't have a 8 MHz MightyCore so I can't help you. I no longer test SdFat with 1284P boards. |
Thank you sir for your prompt response. I am designing a new device which requires more pins than a ATMega 328. Hence I chose the 1284P. The other option I have is a Maple Mini like STM32 board. It is fast, has the pins I need and is cost effective. However the STM32 card returns failure to find the card using the SdInfo.ino. Pin connections made for SP1 and checked multiple times. No sketch works for SD card indicating a basic fault in my system. Does your SdFat support STM32 Core ? |
Arduino STM32 requires the old Arduino IDE 1.6.12. SdFat no longer works reliably on STM32 and I don't want to fix it for 1.6.12. |
Ok |
A short comment: |
Thank you stevstrong. Meanwhile I reopened this because I finally found the problem with my code for the 1284P. First to solve the compiling problem. I needed to modify the GpioPinMap.h file. The original GpioPinMap.h file in the SDfat library under "SdFat/SdFat/src/SdSpiCard/boards/GpioPinMap.h" has the following two lines which need to be changed to compile under the MCUDUDE MightyCore : Near the end of the file : After this the code compiled and uploaded but no luck. SD card could not be read. After nearly 24 hrs of breaking my head on multiple SD card adapters and finally fixing one 'impossible to see' internally broken jumper wire, and trying a zillion other combinations, I found in a 2012 Arduino forum that SdFat SoftwareSpi assumes a Standard or Sanguino pinout and not Bobuino pinout. So I switched to Standard pinout names in the code and BINGO ! it worked ! Thanks Greiman for the library once again. And incidentally I tried it at both 16MHz and 8Mhz too and it works GREAT ! |
At the outset thank you for providing SDFat. I am currently using a MightyCore for 1284P and have successfully tested a SD card using your library on the 1284P running at 3.3V on a external 8MHz crystal on a breadboard using hardware SPI.
However when I used the code provided by you for SoftwareSPI (provided actually for 2560) my code first does not compile at all. and gives an error as below :
In file included from F:\arduino-1.8.2\portable\sketchbook\libraries\SdFat\src/SdSpiCard/DigitalPin.h:45:0,
from F:\arduino-1.8.2\portable\sketchbook\libraries\SdFat\src/SdSpiCard/SoftSPI.h:31,
F:\arduino-1.8.2\portable\sketchbook\libraries\SdFat\src/SdSpiCard/boards/GpioPinMap.h:40:2: error: #error Undefined variant 1284, 644, 324
#error Undefined variant 1284, 644, 324
I have not got this error when using other libraries on 1284P.
Finally I got the code to compile without errors by commenting out everything in GpioPinMap.h and adding the line #include "BobuinoGpioPinMap.h" as I am using the Bobuino pinout. After uploading, I realized my card is not recognized.
I need to use SoftwareSPI as my RC522 with the SD card if both are attached to the same SPI bus.
Kindly provide me with help as to why it does not compile in the first place without modifying Gpio header file and also why it doesnt recognize my card
I am using a SD fat library which says #define SD_FAT_VERSION 20160719
The Mighty Core is also recent I believe as I am using the IDE version 1.8.2 and downloaded it using Boards Manager. I am using Mighty Core MCUdude version 1.0.8
Please help. My code is the same as on this site with pins modified as below :
// An example of the SdFatSoftSpi template class.
// This example is for an Adafruit Data Logging Shield on a Mega.
// Software SPI is required on Mega since this shield connects to pins 10-13.
// This example will also run on an Uno and other boards using software SPI.
//
#include "SdFat.h"
#include <SPI.h>
#if SD_SPI_CONFIGURATION >= 3 // Must be set in SdFat/SdFatConfig.h
//
// Pin numbers in templates must be constants.
const uint8_t SOFT_MISO_PIN = 6;
const uint8_t SOFT_MOSI_PIN = 5;
const uint8_t SOFT_SCK_PIN = 7;
//
// Chip select may be constant or RAM variable.
const uint8_t SD_CHIP_SELECT_PIN = 10;
// SdFat software SPI template
SdFatSoftSpi<SOFT_MISO_PIN, SOFT_MOSI_PIN, SOFT_SCK_PIN> sd;
// Test file.
SdFile file;
void setup() {
Serial.begin(9600);
// Wait for USB Serial
while (!Serial) {
SysCall::yield();
}
Serial.println("Type any character to start");
while (!Serial.available()) {
SysCall::yield();
}
if (!sd.begin(SD_CHIP_SELECT_PIN)) {
sd.initErrorHalt();
}
if (!file.open("SoftSPI.txt", O_CREAT | O_RDWR)) {
sd.errorHalt(F("open failed"));
}
file.println(F("This line was printed using software SPI."));
file.rewind();
while (file.available()) {
Serial.write(file.read());
}
file.close();
Serial.println(F("Done."));
}
//------------------------------------------------------------------------------
void loop() {}
#else // SD_SPI_CONFIGURATION >= 3
#error SD_SPI_CONFIGURATION must be set to 3 in SdFat/SdFatConfig.h
#endif //SD_SPI_CONFIGURATION >= 3
The error I get is :
Type any character to start
Can't access SD card. Do not reformat.
No card, wrong chip select pin, or SPI problem?
SD errorCode: 0X1,0X0
The text was updated successfully, but these errors were encountered: