|
Fianlly i am able to run the code with the following out put
1-Value is deadba0f
2-Value is deadba1f
3-Value is deadba2f
and my code was:
//------------------------------------------------------------------------------ /// Waits for the given number of milliseconds (using the timestamp generated /// by the SAM7 & SAM9 microcontrollers's PIT, or SAM3's microcontrollers's system tick). /// \param delay Delay to wait for, in milliseconds. //------------------------------------------------------------------------------ void Wait(unsigned long delay) { volatile unsigned int start = timestamp; unsigned int elapsed; do { elapsed = timestamp; elapsed -= start; } while (elapsed < delay); }
//------------------------------------------------------------------------------ // Exported functions //------------------------------------------------------------------------------
//------------------------------------------------------------------------------ /// Application entry point. Configures the DBGU, PIT for SAM7 & SAM9 /// microcontrollers, UART and System tick for SAM3 microcontrollers. /// Configures TC0, LEDs and buttons and makes LED\#1 blink in its infinite /// loop, using the Wait function. /// \return Unused (ANSI-C compatibility). //------------------------------------------------------------------------------ int main(void) { char str1[50]; char pString[50]; char pString_set[30]; char pString2[25]; char pString1[25]; char str2[25]; const Pin pPins[] = {PIN_USART0_TXD, PIN_USART0_RXD}; PIO_Configure(pPins, 2); PMC_EnablePeripheral(BOARD_ID_USART); unsigned int mode = AT91C_US_USMODE_HWHSH | AT91C_US_CLKS_CLOCK | AT91C_US_CHRL_8_BITS | AT91C_US_PAR_NONE | AT91C_US_NBSTOP_1_BIT | AT91C_US_CHMODE_NORMAL; USART_Configure(BOARD_USART_BASE, mode, 115200, BOARD_MCK); USART_SetTransmitterEnabled(BOARD_USART_BASE, 1); USART_SetReceiverEnabled(BOARD_USART_BASE, 1); //USART_Configure(uart1,USART_MODE_ASYNCHRONOUS, 57600, BOARD_MCK); //USART_SetTransmitterEnabled(uart1,1);
RTT_SetPrescaler(AT91C_BASE_RTTC,0x8000); sprintf(pString_set, "\n\rSTART_Configure \n\r"); USART_WriteBuffer(BOARD_USART_BASE, pString_set, sizeof(pString_set));
// DBGU output configuration TRACE_CONFIGURE(DBGU_STANDARD, 115200, BOARD_MCK); printf("-- Getting Started Project %s --\n\r", SOFTPACK_VERSION); printf("-- %s\n\r", BOARD_NAME); printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__);
// Configuration #if defined(AT91C_BASE_PITC) TRACE_INFO("configure pit.\n\r"); ConfigurePit(); #else // 1ms tick TRACE_INFO("configure sys tick.\n\r"); SysTick_Configure(1, BOARD_MCK/1000, SysTick_Handler); #endif
ConfigureTc(); ConfigureButtons(); ConfigureLeds();
AT91S_USART * uart1; //uart1 -> US_MR = AT91C_US_USMODE_NORMAL | AT91C_US_CLKS_CLOCK | AT91C_US_CHRL_8_BITS | AT91C_US_NBSTOP_1_BIT; //USART_Configure(uart1,USART_MODE_ASYNCHRONOUS, 57600, BOARD_MCK); BOARD_ConfigureSdram(32);
//unsigned int i=0; //unsigned int j=0; unsigned long *p = (unsigned long *)0x20200040; // Base of SDRAM //for(i=0; i<3; i++) // 64 MB //p[i] = 0xDEADBAEF; p[0] = 0xDEADBA0F; p[1] = 0xDEADBA1F; p[2] = 0xDEADBA2F; unsigned long tmp; /*for(j=0; j<3; j++) // 64 MB { tmp = p[j]; sprintf(pString, "\n\r%x \n\r",tmp); USART_WriteBuffer(BOARD_USART_BASE, pString, sizeof(pString)); }*/ tmp = p[0]; sprintf(pString_set, "\n\r1-Value is %x \n\r",tmp); USART_WriteBuffer(BOARD_USART_BASE, pString_set, sizeof(pString_set)); Wait(50); tmp = p[1]; sprintf(pString2, "\n\r2-Value is %x \n\r",tmp); USART_WriteBuffer(BOARD_USART_BASE, pString2, sizeof(pString2)); Wait(50); tmp = p[2]; sprintf(pString1, "\n\r3-Value is %x \n\r",tmp); USART_WriteBuffer(BOARD_USART_BASE, pString1, sizeof(pString1));
// Wait for 500ms Wait(500); } }
|