Skip to content
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

[2.0.x] Implement SDIO support for STM32F1 #12782

Conversation

jmz52
Copy link
Contributor

@jmz52 jmz52 commented Jan 1, 2019

Description

Add support for SDIO interface for STM32F1.

Benefits

Marlin can used onboard SD cards on MKS Robin and various STM32F1 development boards.

Related Issues

#11641

Additional Information

Two defines are needed to enable SDIO interface
#define SDSUPPORT
#define SDIO_SUPPORT

To add SDIO support for other HALs three functions should be implemented in these HALs
bool SDIO_Init(void);
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst);
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src);

@jmz52 jmz52 changed the title Implement SDIO support for STM32F1 [2.0.x] Implement SDIO support for STM32F1 Jan 1, 2019
dma_set_priority(SDIO_DMA_DEV, SDIO_DMA_CHANNEL, DMA_PRIORITY_VERY_HIGH);


if (!SDIO_CmdGoIdleState()) { return false; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the intention is to ignore the result of the first, doesn't the return false here defeat that? (sorry if I misunderstand what is supposed to happen here).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMD0 does not wait for SD card's response.
False here means that SDIO hardware failed to send command, which should never be the case when SDIO is properly configured and clocked.

@thinkyhead thinkyhead force-pushed the Implement-SDIO-support-for-STM32F1 branch from f18e5f4 to 739a652 Compare January 3, 2019 18:47
@xC0000005
Copy link
Contributor

This method is working for me to read data using SDIO on lerdge boards as well (in the STM32 HAL), so very useful.

@thinkyhead thinkyhead merged commit d372e7e into MarlinFirmware:bugfix-2.0.x Jan 4, 2019
@Phr3d13
Copy link
Contributor

Phr3d13 commented Jan 9, 2019

OMG! Thank you so much for this PR @jmz52! This PR made my GTM32Pro board able to read the reprap discount smart display's SD card. There's only one more hurdle for my board (eeprom). Thank you, thank you, thank you, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants