Hi All,
I am using UART to receive values and then write those values to SRAM. I am using the Texas Instruments Stellaris LM4F120 board.
For this purpose, I am using the memcpy() function to write the received values over UART to my SRAM base address defined. The problem is the function call is made but with no result. Below are some snippets of the code which may be useful for analysis:
char *mycharacter;
//void *my_area = (void*)SRAM_BASE; //SRAM_BASE is defined as 0x20000000
void
UARTIntHandler(void)
{
unsigned long ulStatus;
//
// Get the interrrupt status.
ulStatus = ROM_UARTIntStatus(UART0_BASE, true);
// Clear the asserted interrupts.
ROM_UARTIntClear(UART0_BASE, ulStatus);
// Loop while there are characters in the receive FIFO.
while(ROM_UARTCharsAvail(UART0_BASE))
// Read the next character from the UART and write it back to the UART.
ROM_UARTCharPutNonBlocking(UART0_BASE,
mycharacter =ROM_UARTCharGetNonBlocking(UART0_BASE));
//mycharacter = (char*)ROM_UARTCharGetNonBlocking(UART0_BASE);
memcpy(my_area,&mycharacter,1);
// Blink the LED to show a character transfer is occuring.
Please provide your suggestions!
Thanks!
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);
Though I do not have a TI board myself, I dare answering anyway. - I just hope I provide some useful information.
First of all, I'd like you to consider not using memcpy for copying a single byte only. It would be much, much faster to write the byte value directly into the address 'my_area' points to:
*my_area++ = mycharacter;
...And then change the declaration/definition/assignment to my_area at the top:
char *my_area = (char *) SRAM_BASE;
As you see above, I increment my_area as well; this might be something you're missing in your code above (so your data might all be written to the byte at address 0x20000000).
-Is there a reason that you've commented out 'void *my_area = (void *)SRAM_BASE;' ?