AnsweredAssumed Answered

Problem using UART to transmit messages to an LCD

Question asked by Tschem on Mar 28, 2011
Latest reply on Apr 19, 2011 by Tschem


using the 'initUART.asm' and 'xmitmsg.asm' - files from the uart echo back - project on my adsp21369 ez-kit lite simply to put out a message to a serial lc-display.

the transmission of the welcome-message works perfectly well. but if i call the function "xmitmsg" from another point in my programm (in my case from an ISR called "talkthroughISR") i just get the "||" sign for every char! so, for example, if i want to transmit the string "test" as a welcome message, my display shows "test". if i call the same function "xmitmsg" from an ISR, the display shows "|| || || ||".

"||" seems to be the ascii-equivalent to the "0"char, so if i send a "0" as welcome-message, i get this sign too. the determination of the bufferlength seems to work, because i get one "||"-sign for every char, but the buffer seems to be initialized with zeros, and i don't know why. i went through the whole programm setting breakpoints, the the r0 register holds the right adress. here's the code:





#include <def21369.h>


.global _initUART;
.extern _xmitmsg;
.section/dm seg_dmda;
.var message_on[] = {254, 1, 'ON'};
.var welcome_message[] = {254, 1, 254, 128, 'BOOT'};    
.global welcome_message;
.global message_on;


.section/pm seg_pmco;


/* Sets the Baud rate for UART0 */
ustat1= UARTDLAB;
dm(UART0LCR) = ustat1;          //enables access to Divisor register to set baud rate for UART0


r0=0x38; dm(UART0DLL) = r0;
r0=0x4;  dm(UART0DLH) = r0;     //0x438 = 1080 for divisor value and gives a baud rate of 9600 at 331.776Mhz core clock


/* Configures the UART LCR */
ustat1 = UARTWLS8;              // word length 8
dm(UART0LCR) = ustat1;        // sets UART0 Line with one stop bit, no parity and with baud rate of 9600


ustat1 = UARTEN;
dm(UART0TXCTL) = ustat1;        // enable UART0 transmitter


r0 = welcome_message;
r1 = length(welcome_message);


call _xmitmsg;            // function to transmit welcome message, works perfectly well









#include <def21369.h>
#include "srunewlx3.h"


.section /pm seg_pmco;
.global _talkThroughISR;
.extern handle_MISCA1;
.extern _xmitmsg;
.extern welcome_message;
.extern message_on;



    if FLAG0_IN jump _on;
    if NOT FLAG0_IN jump _off;
    r0 = message_on;
    r1 = length(message_on);
    call _xmitmsg; //call from an ISR, doesn't work at all!!!





hope u can tell me, why it doesn't put out the message "ON" like defined in the initialization but "|| || || ||"

thx in advance,