How to take snapshot of MCF54415 UART control and PAR_UARTn registers?

Discussion to talk about hardware related topics only.
Post Reply
tejada2
Posts: 5
Joined: Tue Jul 27, 2021 8:34 am

How to take snapshot of MCF54415 UART control and PAR_UARTn registers?

Post by tejada2 »

Hello. I'm currently troubleshooting on your development system that we've upgraded from MOD5272 to MOD5441X. We have a support account, but since the question can also be generalized, I am posting here first.

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);
    }
};
I've outputting in this format (I haven't included all the printf statements for brevity):

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
User avatar
TomNB
Posts: 538
Joined: Tue May 10, 2016 8:22 am

Re: How to take snapshot of MCF54415 UART control and PAR_UARTn registers?

Post by TomNB »

Hello,

What software tools version are you using?
tejada2
Posts: 5
Joined: Tue Jul 27, 2021 8:34 am

Re: How to take snapshot of MCF54415 UART control and PAR_UARTn registers?

Post by tejada2 »

Hello Tom. Here is a summary of my software tools:

Build: NetBurner 2.7.7 build tools installed in Windows 10 computer. Build is run for various NetBurner projects by calling NbMake from Visual Studio. We loaded all of our builds into a Visual Studio solution. Also, we have made some modifications to the original NetBurner libraries, and we've applied the same changes every time we upgraded to a new NetBurner library. (I was not involved, but I can find out the details and history of these updates and modifications).

Development: We have 3 NetBurner boards in three different devices connected to a router, not connected to the internet. We have a Windows computer also connected to the router. Each of the 3 NetBurner boards is connected to different hardware, has different firmware and has different roles. The Windows computer interacts with all 3 NetBurner boards with two mechanisms: (1) Custom OPC commands sent as TCP/IP messages, (2) Web page access to web server running in each NetBurner boards. The Windows computer also receives debugging messages from all three Netburner boards with DBT_NET setting. The DBT_CONSOLE setting is disabled early on after each NetBurner board boots. The debug output in my post on 11/12/2021 were printf'ed by the NetBurner board and transmitted by DBT_NET to the Windows computer. The code used to produce that debug output was printf statements printing the contents of the UartBytesSave structure. The save() function was called after the UART port was open.

I also have a NetBurner Mod-Dev-70 Rev 1.4 board, but our application code does not run well on it because all of our hardware is not connected.
User avatar
TomNB
Posts: 538
Joined: Tue May 10, 2016 8:22 am

Re: How to take snapshot of MCF54415 UART control and PAR_UARTn registers?

Post by TomNB »

Hello,

Thank you for that. The tools version is significant because it tells us which uart driver you are using. For reference, there are 3 tools branches:
2.7.7 IPv4 only (no longer maintained)
2.9.x IPv4/v6 dual stack. Current version of 2.x tool set. Note: there is no performance or size penalty for using dual stack. You can ignore v6 and only use v4.
3.x Our latest tool set with enhanced IoT capabilities, latest compiler, Eclipse tools, etc. Required for all ARM platforms.

Migration from 2.7.7 to 2.9.x is fairly simple. Migration from 2.7.7 to 3.x involves a bit more.
https://www.netburner.com/NBDocs/Develo ... uides.html

Anyway, lets get back to 2.7.7 and the uart. No tools update should be necessary to use uart2. Are you using the OpenSerial() functions to open each uart, or have you written your own code?

If your motherboard worked for the 5272, it seems like that should not be any h/w issues.

I don't see any obvious issues with what you have in your first post. If you are using 100% standard API calls to open and use the uarts, a test in the mod-dev-70 development board may be in order. There are serial examples in: \nburn\examples\StandardStack\serial.

Looks like your dev board is from 2006. The current revision is 1.93. I don't have anything of that vintage to look at, but one of the pins for uart2, (J2 19) is used on the mod-dev-70 for the leds and switches. To isolate it, remove resistor R12 on the dev board. If you don't have the rev 1.4 schematic and want to take a look, please contact support and they can get you a copy out of archives (I can't post it here)
tejada2
Posts: 5
Joined: Tue Jul 27, 2021 8:34 am

Re: How to take snapshot of MCF54415 UART control and PAR_UARTn registers?

Post by tejada2 »

Tom,

Thanks for the feedback. I'll reply to your questions soon. We should be using standard API, but I'll have to trace through the calls to confirm. I also need to confirm the we haven't modified the library code. I agree that getting the problem to reproduce on the dev board is an important step.

Regards,
Mauricio
User avatar
pbreed
Posts: 1080
Joined: Thu Apr 24, 2008 3:58 pm

Re: How to take snapshot of MCF54415 UART control and PAR_UARTn registers?

Post by pbreed »

In general we use the sim structures...

#include <pins.h>
#include <sim.h>

Note that a lot of the GPIO registers are read/write only...

How are you setting up the pin assignments?

J2[19].function(PINJ2_19_UART2_TXD );

Is the recommended way.
You can find all the constants in

nburn\mod5441x\include\pinconstant.h


As for access to the Uart registers....again some are wierdly writeonly....

(all these definitions are from nburn\mod5441x\include\sim5441x.h)

typedef struct {
vubyte umr; /* 0x0000 -> 0x0000 - UART Mode Registers */
vubyte pack00[3]; /* 0x0001 -> 0x0003 - RESERVED */
vubyte usr; /* 0x0004 -> 0x0004 - (Read) UART Status Register
(Write) UART Clock Select Register */
vubyte pack01[3]; /* 0x0005 -> 0x0007 - RESERVED */
vubyte ucr; /* 0x0008 -> 0x0008 - (Read) Do Not Access
(Write) UART Command Register */
vubyte pack02[3]; /* 0x0009 -> 0x000B - RESERVED */
vubyte utb; /* 0x000C -> 0x000C - (Read) UART Receive Buffer
(Write) UART Transmit Buffer */
vubyte pack03[3]; /* 0x000D -> 0x000F - RESERVED */
vubyte uipcr; /* 0x0010 -> 0x0010 - (Read) UART Input Port Change Register
(Write) UART Auxiliary Control Register */
vubyte pack04[3]; /* 0x0011 -> 0x0013 - RESERVED */
vubyte uisr; /* 0x0014 -> 0x0014 - (Read) UART Interrupt Status Register
(Write) UART Interrupt Mask Register */
vubyte pack05[3]; /* 0x0015 -> 0x0017 - RESERVED */
vubyte dur; /* 0x0018 -> 0x0018 - (Read) Do Not Access
(Write) UART Divider Upper Register */
vubyte pack06[3]; /* 0x0019 -> 0x001B - RESERVED */
vubyte dlr; /* 0x001C -> 0x001C - (Read) Do Not Access
(Write) UART Divider Lower Register */
vubyte pack07[23]; /* 0x001D -> 0x0033 - RESERVED */
vubyte uip; /* 0x0034 -> 0x0034 - (Read) UART Input Port Register
(Write) Do Not Access */
vubyte pack08[3]; /* 0x0035 -> 0x0037 - RESERVED */
vubyte ops; /* 0x0038 -> 0x0038 - (Read) Do Not Access
(Write) UART Output Port Bit Set Command Register */
vubyte pack09[3]; /* 0x0039 -> 0x003B - RESERVED */
vubyte opr; /* 0x003C -> 0x003C - (Read) Do Not Access
(Write) UART Output Port Bit Reset Command Register */
vubyte pack10[16323]; /* 0x003D -> 0x3FFF - RESERVED */
} uartstruct;


Access is via...
sim2.uarts[x].register listed_above; //For uarts 0..3
sim1.uarts[x]...// where x=uart number-4; for uarts 4..9
Post Reply