- This topic has 0 replies, 1 voice, and was last updated 1 month, 2 weeks ago by
Logan Moon.
-
AuthorPosts
-
February 6, 2025 at 10:34 pm #16840
(This message was transferred over from our old forum)
Posted August 19, 2015
By Todd DeBoer
[hr]
On 6/13/12 jspayneco asked, “I see mention of SDHC support but I cannot get an SDcard of more than 2GB to work. We have been told that 2GB cards are going obsolete. I am using rev 1.10 which should have support for SDHC as per the revision history -> it was added in 1.06.” and added that he couldn’t just upgrade the device because they were using custom code.”
[hr]
(Follow up post)Answered:
Instead of upgrading (which I agree may be more than you want to do yet), you might be able to use the SPI version instead of the SSP version and get the fixes (they got put into SPI but not SSP). It will require changing your platform file. I believe we have these compile options in the platform:
#define SDCARD_USES_SSP 1
#define SDCARD_USES_SPI 0It enables one of the following two pieces of code:
#if SDCARD_USES_SPI
// Setup CS on P2.21 and SPI0
UEZDeviceTableFind(“SPI0”, &spi);
UEZDeviceTableGetWorkspace(spi, (T_uezDeviceWorkspace **)&p_spi);
HALInterfaceFind(“GPIO0”, (T_halWorkspace **)&p_gpio0);
extern void MassStorage_SDCard_ConfigureSPI(
void *aWorkspace,
DEVICE_SPI_BUS **aSPI,
HAL_GPIOPort **aGPIOPort,
TUInt32 aGPIOBit);
MassStorage_SDCard_ConfigureSPI(
ms1,
(DEVICE_SPI_BUS **)p_spi,
(HAL_GPIOPort **)p_gpio0, // P0.16 is CS
(1<<16)); #endif #if SDCARD_USES_SSP // Setup CS on P0.16 and SPI0 UEZDeviceTableFind(“SSP0”, &ssp0); UEZDeviceTableGetWorkspace(ssp0, (T_uezDeviceWorkspace **)&p_ssp0); HALInterfaceFind(“GPIO0”, (T_halWorkspace **)&p_gpio0); MassStorage_SDCard_ConfigureSSP( ms1, (DEVICE_SSP_BUS **)p_ssp0, (HAL_GPIOPort **)p_gpio2, // P2.21 is CS (1<<21)); #endif But I’m forgetting if you need to use a different SPI (SPI1 instead of SPI0) and the chip select will be modified in the above. And the pinConfig.h file may need to also be changed (NOTE: v2.00 gets rid of the pinConfig.h file) to use SPI instead of SSP. Finally, another trick/hack is to use the SSP driver as a SPI driver. One of the reasons we deprecated the SSP device device driver interface was because the SSP is really a SPI driver and should never have been its own API. But they have the same functions. Be warned, you may need to pull in a later LPC1788_SSP.c driver from uEZ v1.12 as there were some added functions (and I’m forgetting when, but function LPC1788_SSP_TransferInOutBytes MUST exist in LPC1788_SSP.c). You can do the hack by using the following modified SPI code: // Setup CS on P2.21 and SPI0 UEZDeviceTableFind(“SSP0”, &spi); <– note we using the SSP driver as a spi driver here UEZDeviceTableGetWorkspace(spi, (T_uezDeviceWorkspace **)&p_spi); HALInterfaceFind(“GPIO0”, (T_halWorkspace **)&p_gpio0); extern void MassStorage_SDCard_ConfigureSPI( void *aWorkspace, DEVICE_SPI_BUS **aSPI, HAL_GPIOPort **aGPIOPort, TUInt32 aGPIOBit); MassStorage_SDCard_ConfigureSPI( ms1, (DEVICE_SPI_BUS **)p_spi, (HAL_GPIOPort **)p_gpio2, // P0.16 is CS (1<<21)); <– changed the chip select back to P2.21 from the SPI code -
AuthorPosts
- You must be logged in to reply to this topic.