We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi guys I try to use MCI Controller in LPC2368. I'm using the example on "code.bundle.lpc23xx.lpc24xx.uvision.zip" program for LPC236X for testing the SD card by reading to it and verifying. this code work well and init mmc and init mci controller but when i want read a sector on mmc with "MCI_Read_Block",micro is crashing on line "MCI_DATA_CTRL = DataCtrl;" !!!
"MCI_Read_Block" routine:
DWORD MCI_Read_Block( DWORD blockNum ) { DWORD i; DWORD DataCtrl = 0; MCI_CLEAR = 0x7FF; MCI_DATA_CTRL = 0; Set_MCIClock(NORMAL_RATE); for ( i = 0; i < 0x10; i++ ); if ( MCI_CheckStatus() != TRUE ) { MCI_Send_Stop(); return( FALSE ); } MCI_RXEnable(); MCI_DATA_TMR = DATA_TIMER_VALUE; MCI_DATA_LEN = BLOCK_LENGTH; if ( MCI_Send_Read_Block( blockNum ) == FALSE ) { return ( FALSE ); } #if MCI_DMA_ENABLED DMA_Init( 1, P2M ); GPDMA_CH1_CFG |= 0x10001 | (0x04 << 1) | (0x00 << 6) | (0x06 << 11); DataCtrl |= ((1 << 0) | (1 << 1) | (1 << 3) | (DATA_BLOCK_LEN << 4)); #else DataCtrl |= ((1 << 0) | (1 << 1) | (DATA_BLOCK_LEN << 4)); #endif MCI_DATA_CTRL = DataCtrl; <---crashing in line!!! for ( i = 0; i < 0x10; i++ ); return ( TRUE ); }
Please Help Me :( thanks.