This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EK-TM4C1294XL: Boot loader question(s)

Part Number: EK-TM4C1294XL

Tool/software:

Hi Charles :) so let us continue here...

So, in the meantime I managed to make to bootloader work... in a way. I'm saying this as because it works, but there are questions that I have to ask.

First, I used "Blinky" to test the ROM bootloader. It worked, but the timing wasn't really the same in Blinky and in the bootloader. So, normally, I would think that I have crystal in the system that defines the freq and so the delay routines. Blinky was blinking lets say normally, 100ms on and off, but when I uploaded it with the ROM bootloader, it went into vibrating rather blinking. Then I saw the delay routine in Blinky, it is actually an empty loop.

1. Why the blinking changed to much faster?

Then, I was trying to investigate the printouts on the debug port. I can't find the moment in the code where it is actually printing out characters on the debug port. 

2. Where should I look?

So I inserted the following:

UARTCharPut(UART0_BASE, '\n');
    for (i = 0; g_pcMACAddr[i] != '\0'; i++)
        UARTCharPut(UART0_BASE, g_pcMACAddr[i]);
    UARTCharPut(UART0_BASE, '\n');

    for (i = 0; g_pcIPAddr[i] != '\0'; i++)
        UARTCharPut(UART0_BASE, g_pcIPAddr[i]);
    UARTCharPut(UART0_BASE, '\n');

    UARTCharPut(UART0_BASE, 'W');  // "Waiting"
    UARTCharPut(UART0_BASE, '8');
    UARTCharPut(UART0_BASE, '\n');
It did not print out all, but the last 3 characters as W8
The actual real print outs came from the function called SetupForEthernet()
usnprintf(g_pcMACAddr, SIZE_MAC_ADDR_BUFFER,
              "MAC: %02X-%02X-%02X-%02X-%02X-%02X",
              pui8MACAddr[0], pui8MACAddr[1], pui8MACAddr[2], pui8MACAddr[3],
              pui8MACAddr[4], pui8MACAddr[5]);

    //
    // Remember that we don't have an IP address yet.
    //
    usnprintf(g_pcIPAddr, SIZE_IP_ADDR_BUFFER, "IP: Not assigned");
3. how is this code actually printing on the debug port?
4. why it did not print the MAC and the IP, only the "W8"?
Thanks for all the suggestions!
Gabor
  • First, I used "Blinky" to test the ROM bootloader. It worked, but the timing wasn't really the same in Blinky and in the bootloader. So, normally, I would think that I have crystal in the system that defines the freq and so the delay routines. Blinky was blinking lets say normally, 100ms on and off, but when I uploaded it with the ROM bootloader, it went into vibrating rather blinking. Then I saw the delay routine in Blinky, it is actually an empty loop.
    1. Why the blinking changed to much faster?

    Which blinky program is this? Is this your own blinky or the blinky example TivaWare. Once your blinky or whichever program is loaded, the delay or the blinky rate should base on the System Clock you configure during the application initialization. In another word, you should see the same blinking rate as if you were loading that blinky program using JTAG. I don't understand what you mean that the blinky rate becomes vibrating which I suppose to blink much much faster. 

    Why don't you load the TivaWare blinky example first? Do you see a different blinky rate between loading it using Ethernet vs. loading using JTAG?

    Then, I was trying to investigate the printouts on the debug port. I can't find the moment in the code where it is actually printing out characters on the debug port. 

    2. Where should I look?

    So I inserted the following:

    UARTCharPut(UART0_BASE, '\n');
        for (i = 0; g_pcMACAddr[i] != '\0'; i++)
            UARTCharPut(UART0_BASE, g_pcMACAddr[i]);
        UARTCharPut(UART0_BASE, '\n');

        for (i = 0; g_pcIPAddr[i] != '\0'; i++)
            UARTCharPut(UART0_BASE, g_pcIPAddr[i]);
        UARTCharPut(UART0_BASE, '\n');

        UARTCharPut(UART0_BASE, 'W');  // "Waiting"
        UARTCharPut(UART0_BASE, '8');
        UARTCharPut(UART0_BASE, '\n');
    It did not print out all, but the last 3 characters as W8
    The actual real print outs came from the function called SetupForEthernet()
    usnprintf(g_pcMACAddr, SIZE_MAC_ADDR_BUFFER,
                  "MAC: %02X-%02X-%02X-%02X-%02X-%02X",
                  pui8MACAddr[0], pui8MACAddr[1], pui8MACAddr[2], pui8MACAddr[3],
                  pui8MACAddr[4], pui8MACAddr[5]);

        //
        // Remember that we don't have an IP address yet.
        //
        usnprintf(g_pcIPAddr, SIZE_IP_ADDR_BUFFER, "IP: Not assigned");
    3. how is this code actually printing on the debug port?
    4. why it did not print the MAC and the IP, only the "W8"?

    How is g_pcMACAddr loaded with the MAC address in your program? Why don't you refer to enet_lwip example? The MAC address is stored in the USER0/USER1 registers. If you look at the enet_lwip, it calls FlashUserGet to store the MAC address into ui32User0 and ui32User1 variables and later assign them to pui8MacArray array where it is passed to the lwIPInit() function. If you want to print out the MAC address, you will first call FlashUserGet  and then send it out of the UART. You can use UARTCharPut if you want but there is the UARTPrintf() API that is more convenient to send the string to the terminal.  

        //
        // Configure the hardware MAC address for Ethernet Controller filtering of
        // incoming packets.  The MAC address will be stored in the non-volatile
        // USER0 and USER1 registers.
        //
        MAP_FlashUserGet(&ui32User0, &ui32User1);
        if((ui32User0 == 0xffffffff) || (ui32User1 == 0xffffffff))
        {
            //
            // We should never get here.  This is an error if the MAC address has
            // not been programmed into the device.  Exit the program.
            // Let the user know there is no MAC address
            //
            UARTprintf("No MAC programmed!\n");
            while(1)
            {
            }
        }
    
        //
        // Tell the user what we are doing just now.
        //
        UARTprintf("Waiting for IP.\n");
    
        //
        // Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC
        // address needed to program the hardware registers, then program the MAC
        // address into the Ethernet Controller registers.
        //
        pui8MACArray[0] = ((ui32User0 >>  0) & 0xff);
        pui8MACArray[1] = ((ui32User0 >>  8) & 0xff);
        pui8MACArray[2] = ((ui32User0 >> 16) & 0xff);
        pui8MACArray[3] = ((ui32User1 >>  0) & 0xff);
        pui8MACArray[4] = ((ui32User1 >>  8) & 0xff);
        pui8MACArray[5] = ((ui32User1 >> 16) & 0xff);

    In any case, I will suggest you do:

    1. Erase the flash

    2. Use the ROM-base Ethernet bootloader to load the TivaWare example enet_lwip. You can also load other examples like enet_io or enet_tcppecho_server. 

    3. Use Wireshark to see how the ROM bootloader loads the program using TFTP protocol.