Our NetBurner application is quite large and convoluted by now, so I'm trying to debug/troubleshoot in place before restoring to extracting the code and the NetBurner board to the development board. The problem that we are having is that we appear to be receiving "ghost" data through UART2. We don't have a problem with UART0 send or receive.
In order to troubleshooting this, I've tried to insert code that takes a snapshot of the MCF54415 UARTn and PAR_UARTn registers so that I can confirm that our (convoluted) code has set up the UART correctly. Later, I have code that prints the UART data to the console.
Is there a recommended way to snapshot the UARTn control registers and the PAR_UARTn registers?
Thank you,
Mauricio Tejada
Relevant parts of my snapshotting code as follows:
Code: Select all
class UartBytesSave
{
public:
int uart_num;
char uart_bytes[20];
private:
static const unsigned long int UART_BASE_ADDRESS = 0x10000000;
static const unsigned short int UART_ADD_OFFSET = 0x0040;
typedef volatile unsigned char vuint8;
public:
UartBytesSave()
{
uart_num = 99;
}
void save(int a)
{
uart_num = a;
uart_bytes[0] = MCF5272_UART_UMR(a);
uart_bytes[1] = MCF5272_UART_USR(a);
uart_bytes[2] = 0; // MCF5272_UART_UCSR(a);
uart_bytes[3] = 0; //MCF5272_UART_UCR(a);
uart_bytes[4] = MCF5272_UART_URB(a);
uart_bytes[5] = 0; //MCF5272_UART_UTB(a);
uart_bytes[6] = MCF5272_UART_UIPCR(a);
uart_bytes[7] = 0; //MCF5272_UART_UACR(a);
uart_bytes[8] = MCF5272_UART_UISR(a);
uart_bytes[9] = 0; //MCF5272_UART_UIMR(a);
uart_bytes[10] = 0; //MCF5272_UART_UBG1(a);
uart_bytes[11] = 0; //MCF5272_UART_UBG2(a);
#ifdef MOD5272
uart_bytes[12] = MCF5272_UART_UABR1(a);
uart_bytes[13] = MCF5272_UART_UABR2(a);
uart_bytes[14] = MCF5272_UART_UTFCSR(a);
uart_bytes[15] = MCF5272_UART_URFCSR(a);
uart_bytes[16] = MCF5272_UART_UFPD(a);
#endif
#ifdef MOD5441X
uart_bytes[12] = 0; //MCF5272_UART_UABR1(a);
uart_bytes[13] = 0; //MCF5272_UART_UABR2(a);
uart_bytes[14] = 0; //MCF5272_UART_UTFCSR(a);
uart_bytes[15] = 0; //MCF5272_UART_URFCSR(a);
uart_bytes[16] = 0; //MCF5272_UART_UFPD(a);
#endif
uart_bytes[17] = MCF5272_UART_UIP(a);
uart_bytes[18] = 0; //MCF5272_UART_UOP1(a);
uart_bytes[19] = 0; //MCF5272_UART_UOP0(a);
}
};
Code: Select all
---------- UART0 Bytes ---------- ---------- UART2 Bytes ----------
UMR(0) 27 UMR(2) 27
USR(0) 0 USR(2) 0
UCSR(0)* 0 UCSR(2)* 0
UCR(0)* 0 UCR(2)* 0
URB(0) FF URB(2) FF
UTB(0)* 0 UTB(2)* 0
UIPCR(0) 0F UIPCR(2) 0F
UACR(0)* 0 UACR(2)* 0
UISR(0) 0 UISR(2) 0
UIMR(0)* 0 UIMR(2)* 0
UBG1(0)* 0 UBG1(2)* 0
UBG2(0)* 0 UBG2(2)* 0
UABR1(0) 0 UABR1(2) 0
UABR2(0) 0 UABR2(2) 0
UTFCSR(0) 0 UTFCSR(2) 0
URFCSR(0) 0 URFCSR(2) 0
UFPD(0) 0 UFPD(2) 0
UABR1(0)* 0 UABR1(2)* 0
UABR2(0)* 0 UABR2(2)* 0
UTFCSR(0)* 0 UTFCSR(2)* 0
URFCSR(0)* 0 URFCSR(2)* 0
UFPD(0)* 0 UFPD(2)* 0
UIP(0) F UIP(2) FF
UOP1(0)* 0 UOP1(2)* 0
UOP0(0)* 0 UOP0(2)* 0