Hello Dave, Thank you for your response, but if that is correct then the driver do not work for imxrt1050 because of following #if defined(CONFIG_MMCSD_HAVE_CARDDETECT) # if defined(PIN_USDHC1_CD) imxrt_config_gpio(PIN_USDHC1_CD); # else if (priv->sw_cd_gpio != 0) { imxrt_config_gpio(priv->sw_cd_gpio); } # endif #endif
here you initialize the PIN_USDHC1_CD but you never say that sw_cd_gpio = PIN_USDHC1_CD which makes the following check to fail and never use the PIN_USDHC1_CD for detecting if (priv->sw_cd_gpio != 0) { present = priv->cd_invert ^ !imxrt_gpio_read(priv->sw_cd_gpio); } else { so if _GPIO suffix need to stay then the following lines need to be changes lines 3088 - 3097 #if defined(CONFIG_MMCSD_HAVE_CARDDETECT) # if defined(PIN_USDHC1_CD) imxrt_config_gpio(PIN_USDHC1_CD); # else if (priv->sw_cd_gpio != 0) { imxrt_config_gpio(priv->sw_cd_gpio); } # endif #endif need to be # if defined(PIN_USDHC1_CD) priv->sw_cd_gpio = PIN_USDHC1_CD ; imxrt_config_gpio(PIN_USDHC1_CD); # else if (priv->sw_cd_gpio != 0) { imxrt_config_gpio(priv->sw_cd_gpio); } # endif #endif On Thu, Jan 30, 2020 at 2:57 PM David Sidrane <david.sidr...@nscdg.com> wrote: > Hi Ivan, > > > It is correct. It fixes a bug that was added when the imxrt1020 came in. > Apparently Dave did not wire the CD pin of the IC to the socket (He used a > GPIO). But that change broke the case were the CD pin of the IC is wired to > the socket > > Please See > > https://github.com/apache/incubator-nuttx/commit/2e71e0632f8106d1505d313e7171904536feec45#diff-787575b8e98a29e0a9d088767a68b280 > > It is to use allow the use of a standard GPIO pin for card detect OR the > use of the USDHC dedicated CD pin. (it also supports inversion of the pin > or > CD detect bit) > > If you wire CD to the USDHC CD pin you define PIN_USDHC1_CD (as > PIN_USDHC1_CD_n) in board.h. > > See > > https://github.com/apache/incubator-nuttx/blob/master/boards/arm/imxrt/imxrt1060-evk/include/board.h#L215 > > If you use a regular GPIO you define PIN_USDHC1_CD_GPIO (as GPIO_PORTn | > GPIO_PINn) in board.h > > See > > https://github.com/apache/incubator-nuttx/blob/master/boards/arm/imxrt/imxrt1020-evk/include/board.h#L271 > > > Regards, > > David > > -----Original Message----- > From: Embedded Systems [mailto:ivanucherdj...@gmail.com] > Sent: Wednesday, January 29, 2020 11:51 PM > To: dev@nuttx.apache.org > Subject: IMXRT1050 USDHC > > Hello, > > I found a typo mistake in the USDHC driver related to the card detect pin. > It is a pretty simple one. Can someone tell me how toapplay a patch for it. > Or someone who know how to do it do the following changes and apply them. > Thank you in advance! > > in file /arch/arm/src/imxrt/imxrt_usdhc.c > > Line 379-381 > > #if defined(PIN_USDHC1_CD_GPIO) > .sw_cd_gpio = PIN_USDHC1_CD_GPIO, > #endif > should be changed to > #if defined(PIN_USDHC1_CD) > .sw_cd_gpio = PIN_USDHC1_CD, > #endif > > And same file at lines 437-439 > > #if defined(PIN_USDHC2_CD_GPIO) > .sw_cd_gpio = PIN_USDHC2_CD_GPIO, > #endif > > should be changed to > > #if defined(PIN_USDHC2_CD) > .sw_cd_gpio = PIN_USDHC2_CD, > #endif > > > > -- > Kind regards, > Ivan Ucherdzhiev > > Team Lead @ Barin Sports > Bulgaria > skype: ipy_44 > tel: +359888927760 > -- Kind regards, Ivan Ucherdzhiev Team Lead @ Barin Sports Bulgaria skype: ipy_44 tel: +359888927760