<edited, my initial post was prematurely submitted>
Hello, I am extremely new at working with microcontrollers, and I’m new at C as well.
I’m working on the Logomatic main.c code, we have the board set to record analog inputs and then also record what is received on UART0 along with each sample.
The plan was to take the code that was executed for the UART-reading ISR and execute it during the analog-reading ISR.
I took all of the initialization code from the UART mode and inserted it into the analog mode initialization code.
These are the UART initialization commands I am executing:
U0LCR = 0x83; // 8 bits, no parity, 1 stop bit, DLAB = 1
if(baud == 1200)
…
else if(baud == 115200)
{
U0DLM = 0x00;
U0DLL = 0x20;
}
U0FCR = 0x01;
U0LCR = 0x03;
U0IER = 0x01;
Now when the analog-reading ISR is triggered, I execute the default analog collection commands but I also add in UART collection commands. I have shortened them down to the following code:
while(1)
{
RX_array1[RX_in] = U0RBR;
if(RX_array1[RX_in] != 0x00)
{
rprintf("found something ");
rprintf(“read from uart = %c\n\r”,RX_array1[RX_in]);
RX_in++;
}
}
I have run the program with the board connected to my computer via a TTL/RS-232 converter. When I send the program a message in the terminal, only the first letter of the message is received and echoed back to me. So if I send it “Hello there”, in response I get is “found something read from uart = H”.
The desired behavior is for the board to read every character I send to the UART (H e l l o t h e r e), but it’s not happening. I suspect there is a buffer or timing issue. Before I put the command RX_array[…] = U0RBR in a while loop, I wasn’t reading anything. Does anyone have any pointers?
Thank you!