Closed TomEngr44 closed 2 years ago
Here is the BRR & BSRR solution. Replace the code in the file "Sd2Card.cpp" with this (the original lines have been commented out and replaced with Photon compatible code): for (uint8_t bit = 0; bit < 8; bit++) { if (data & (1 << (7-bit))) // walks down mask from bit 7 to bit 0 //PINMAP[mosiPin].gpio_peripheral->BSRR = PINMAP[mosiPin].gpiopin; // Data High pinSetFast(mosiPin); else //PINMAP[mosiPin].gpio_peripheral->BRR = PINMAP[mosiPin].gpiopin; // Data Low pinResetFast(mosiPin);
//PIN_MAP[clockPin_].gpio_peripheral->BSRR = PIN_MAP[clockPin_].gpio_pin; // Clock High
pinSetFast(clockPin_);
b <<= 1;
//if (PIN_MAP[misoPin_].gpio_peripheral->IDR & PIN_MAP[misoPin_].gpio_pin)
if (pinReadFast(misoPin_))
b |= 1;
//PIN_MAP[clockPin_].gpio_peripheral->BRR = PIN_MAP[clockPin_].gpio_pin; // Clock Low
pinResetFast(clockPin_);
}
Here is an updated library: https://github.com/head-labs/sd-card-library
Yes, thanks for the feedback.
I found a similar solution in another thread and got the SD card routines working some time ago.
But I will review this against what I have now and keep experimenting.
Regards,
Tom Ritter
From: puneetteja [mailto:notifications@github.com] Sent: Sunday, November 22, 2015 5:24 AM To: technobly/SparkCore-SD SparkCore-SD@noreply.github.com Cc: TomEngr44 ritter_thomas_0044@sbcglobal.net Subject: Re: [SparkCore-SD] SD card library returns BSRR and BRR error messages (#5)
Here is the BRR & BSRR solution. Replace the code in the file "Sd2Card.cpp" with this (the original lines have been commented out and replaced with Photon compatible code): for (uint8_t bit = 0; bit < 8; bit++) { if (data & (1 << (7-bit))) // walks down mask from bit 7 to bit 0 //PINMAP[mosiPin].gpio_peripheral->BSRR = PINMAP[mosiPin].gpiopin; // Data High pinSetFast(mosiPin); else //PINMAP[mosiPin].gpio_peripheral->BRR = PINMAP[mosiPin].gpiopin; // Data Low pinResetFast(mosiPin);
//PIN_MAP[clockPin_].gpio_peripheral->BSRR = PIN_MAP[clockPin_].gpio_pin; // Clock High
pinSetFast(clockPin_);
b <<= 1;
//if (PIN_MAP[misoPin_].gpio_peripheral->IDR & PIN_MAP[misoPin_].gpio_pin)
if (pinReadFast(misoPin_)) b |= 1;
//PIN_MAP[clockPin_].gpio_peripheral->BRR = PIN_MAP[clockPin_].gpio_pin; // Clock Low
pinResetFast(clockPin_);
}
— Reply to this email directly or view it on GitHub https://github.com/technobly/SparkCore-SD/issues/5#issuecomment-158743498 . https://github.com/notifications/beacon/AMTnFfyF2HP0vKWHZcmkwclUz93NYvgmks5pIY9OgaJpZM4Fwryt.gif
SD_CARD_LIBRARY examples Spark-DataLogger.cpp, Spark-ReadWrite.cpp and my own application files all yield the following error messages:
sd-card-library/sd2-card.cpp: In member function 'uint8_t Sd2Card::sparkSPISend(uint8_t)':
sd-card-library/sd2-card.cpp:764:40: error: 'struct GPIO_TypeDef' has no member named 'BSRR' PINMAP[mosiPin].gpio_peripheral->BSRR = PINMAP[mosiPin].gpio_pin; // Data High
sd-card-library/sd2-card.cpp:766:40: error: 'struct GPIO_TypeDef' has no member named 'BRR' PINMAP[mosiPin].gpio_peripheral->BRR = PINMAP[mosiPin].gpio_pin; // Data Low
sd-card-library/sd2-card.cpp:768:40: error: 'struct GPIO_TypeDef' has no member named 'BSRR' PINMAP[clockPin].gpio_peripheral->BSRR = PINMAP[clockPin].gpio_pin; // Clock High
sd-card-library/sd2-card.cpp:774:40: error: 'struct GPIO_TypeDef' has no member named 'BRR' PINMAP[clockPin].gpio_peripheral->BRR = PINMAP[clockPin].gpio_pin; // Clock Low