Hello all,
I've build a program to write some data onto a MMCSD card. I'm using a XDS100v1 emulator to connecto to my custom board for the c5535 DSP. I've been able to connect to the board and load my program onto it and debug it. On running it in Debug mode it runs perfectly till the end of the program.
The target configuration was in "debug" mode. I now burnt the program onto the SPI flash using the SPI flash programmer on http://processors.wiki.ti.com/index.php/C5535_Boot-Image_Programmer. The command I used with the hex55 utility was:
hex55 -boot -v5505 -serial8 -b -o bootimg.bin *.out
Then I boot cycled my processor, and the program starts! everything is great till here and nows where the problem comes in. The program runs, lets me initialize the GPIO port, toggle a LED on the GPIO pin, also detects SD card and initializes the SD card registers. But then at teh function
mmcStatus = MMC_write(mmcsdHandle, 0x0000, BUFFER_MAX_SIZE, gWriteBuff);
it pauses/stops/breakstops/??/does not proceed after that.
Funny thing is if while the program is still paused at this particular point, I do CCS>Target>connect_to_target and click "run", the program proceeds till the end and I observe data written on the SD card.
Any ideas on why it is pausing at MMC_Write() while running in standalone mode?
Thanks,
Milind
//NOTE: IT IS NOT NEEDED TO LOOK THROUGH THE CODE BELOW AS I KNOW THAT THE PROGRAM NOW PAUSES AT MMC_WRITE() -Milind 03/23/2012
/* Initialize MMCSD module */
mmcStatus = MMC_init();
if (mmcStatus != CSL_SOK)
{
//##printf("API: MMC_init Failed!\n");
return(mmcStatus);
}
/* Initialize Dma */
mmcStatus = DMA_init();
if (mmcStatus != CSL_SOK)
{
//##printf("API: DMA_init Failed!\n");
return(mmcStatus);
}
flashLEDnTimes(10000);//3
/* Open Dma channel for MMCSD write */
dmaWrHandle = DMA_open(CSL_DMA_CHAN0, &dmaWrChanObj, &mmcStatus);
if((dmaWrHandle == NULL) || (mmcStatus != CSL_SOK))
{
//##printf("API: DMA_open for MMCSD Write Failed!\n");
return(mmcStatus);
}
/* Open Dma channel for MMCSD read */
dmaRdHandle = DMA_open(CSL_DMA_CHAN1, &dmaRdChanObj, &mmcStatus);
if((dmaRdHandle == NULL) || (mmcStatus != CSL_SOK))
{
//##printf("API: DMA_open for MMCSD Read Failed!\n");
return(mmcStatus);
}
/* Open the MMCSD module */
#ifdef C5515_EZDSP
mmcsdHandle = MMC_open(&pMmcsdContObj, CSL_MMCSD1_INST, opMode, &mmcStatus);
#else
mmcsdHandle = MMC_open(&pMmcsdContObj, CSL_MMCSD0_INST, opMode, &mmcStatus);
#endif
if((mmcStatus != CSL_SOK) || (mmcsdHandle == NULL))
{
//##printf("API: MMC_open Failed\n");
return(mmcStatus);
}
flashLEDnTimes(10000);//4
/* Set the DMA handles */
if(opMode == CSL_MMCSD_OPMODE_DMA)
{
/* Set the DMA handle for MMC read */
mmcStatus = MMC_setDmaHandle(mmcsdHandle, dmaWrHandle, dmaRdHandle);
if(mmcStatus != CSL_SOK)
{
//##printf("API: MMC_setDmaHandle for MMCSD Failed\n");
return(mmcStatus);
}
}
/* Send CMD0 to the card */
mmcStatus = MMC_sendGoIdle(mmcsdHandle);
if(mmcStatus != CSL_SOK)
{
//##printf("API: MMC_sendGoIdle Failed\n");
return(mmcStatus);
}
/* Check for the card */
mmcStatus = MMC_selectCard(mmcsdHandle, &mmcCardObj);
if((mmcStatus == CSL_ESYS_BADHANDLE) ||
(mmcStatus == CSL_ESYS_INVPARAMS))
{
//##printf("API: MMC_selectCard Failed\n");
return(mmcStatus);
}
flashLEDnTimes(10000);//5
//POSTED CORRECTION BELOW
if(mmcCardObj.cardType == CSL_SD_CARD)
{
printf("SD Card Detected!\n");
cardType = CSL_SD_CARD;
/* Check if the card is high capacity card */
if(mmcsdHandle->cardObj->sdHcDetected == TRUE)
{
printf("SD card is High Capacity Card\n");
printf("Memory Access Uses Block Addressing\n\n");
/* For the SDHC card Block addressing will be used.
Sector address will be same as sector number */
cardAddr = sectCount;
}
else
{
printf("SD card is Standard Capacity Card\n");
printf("Memory Access Uses Byte Addressing\n\n");
/* For the SD card Byte addressing will be used.
Sector address will be product of sector number and sector size */
cardAddr = (sectCount)*(CSL_MMCSD_BLOCK_LENGTH);
}
/* Set the init clock */
mmcStatus = MMC_sendOpCond(mmcsdHandle, 70);
if(mmcStatus != CSL_SOK)
{
printf("API: MMC_sendOpCond Failed\n");
return(mmcStatus);
}
/* Send the SD card identification Data */
mmcStatus = SD_sendAllCID(mmcsdHandle, &cardIdObj);
if(mmcStatus != CSL_SOK)
{
printf("API: SD_sendAllCID Failed\n");
return(mmcStatus);
}
/* Set the SD Relative Card Address */
mmcStatus = SD_sendRca(mmcsdHandle, &mmcCardObj, &rca);
if(mmcStatus != CSL_SOK)
{
printf("API: SD_sendRca Failed\n");
return(mmcStatus);
}
/* Read the SD Card Specific Data */
mmcStatus = SD_getCardCsd(mmcsdHandle, &cardCsdObj);
if(mmcStatus != CSL_SOK)
{
printf("API: SD_getCardCsd Failed\n");
return(mmcStatus);
}
/* Get the clock divider value for the current CPU frequency */
clockDiv = computeClkRate(CSL_SD_CLOCK_MAX_KHZ);
printf("MMC_sendOpCond(mmcsdHandle, clockDiv); clockDiv is : %d\n",clockDiv);
}