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.

Why UART is not working when booting from SPI flash with 6431?

Dear Sir,

I can run my project well with emulator.

But when I boot my project from SPI flash, the UART interface would fail.

UART interface can work when I do : SPI boot --> Connect from emulator --> Load symbol --> Restart --> Run

I guess there is something set in the .gel file but I didn't set it in my project. I can not locate the missing setting.

Do you have any suggestion for this bug? Really appreciate your help!

 

Best Regards,

 

Eric Fang

 

  • Eric,

    Since you seem to be having lots of problems related to Gel file functions that are missing when you burn a flash image, you might want to take a look at the board support library that was installed with your dev kit.  Mine was in the CCS directory/boards/evmdm6437_v2\lib\evmdm6437bsl.  If you look at evmdm6437.c, you will find C versions of everything that the gel file does.  You will have to do some investigating to figure out what needs to be stripped out or modified to go from the 6437 to the 6431, but this will give you a good starting point.  You can then call this modified code at startup in your project to perform required board initialization.

  • Dear Matt,

    I study the UART code under the directory you refer, and I copy one of the uart API to my project in main( ), and it works!!

    Really appreciate your help!!

     

    Please refer to the following for the code I add:

    void DM6431_UART_open( Uint32 baudrate )
    {
        UART_Handle uart_handle;
        Uint32 divisor;

        divisor = 27000000 / ( baudrate * 16 );

        uart_handle = ( UART_Handle )&UART_MODULE_0;
        uart_handle->regs->PWREMU_MGMT = 0;     // Reset UART TX & RX components

        _wait( 100 );

        uart_handle->regs->DLL = ( divisor & 0xff );    // Set baud rate
        uart_handle->regs->DLH = ( divisor >> 8 ) & 0xff;

        uart_handle->regs->FCR = 0x0007;        // Clear UART TX & RX FIFOs
        uart_handle->regs->FCR = 0x0001;        // Enable TX & RX FIFOs 1-byte
        uart_handle->regs->IER = 0x0007;        // Enable interrupts
        uart_handle->regs->LCR = 0x0003;        // 8-bit words,
                                                // 1 STOP bit generated,
                                                // No Parity, No Stick paritiy,
                                                // No Break control
        uart_handle->regs->MCR = 0x0000;        // RTS & CTS disabled,
                                                // Loopback mode disabled,
                                                // Autoflow disabled

        uart_handle->regs->PWREMU_MGMT = 0x6001; // Emulation Free,
                                                 // Enable TX & RX componenets
    }

    Best Regards,

     

    Eric Fang

     

     

     

     

     

  • Thanks for posting the tips here, Matt.

    One of the "problems" with developing code in CCS is that a lot of times folks rely on the GEL functions to properly function without even realizing it. Things like PINMUX, PSC, EMIF, and other such peripheral registers are configured automatically every time CCS connects to a board. This creates unexpected behavior when moving to a stand-alone system where the code is loaded from Flash instead of from CCS.

    As a side note, most GEL files for Spectrum Digital boards (at least for newer boards) can be found either on the board support page or inside the target content on the same page on Spectrum Digital's support site.

  • Hi, I have the same problem and I'm using DM6437.

    Why your function is void rather than a handle? Shouldn't you return a handle and putChar with that handle?

    My UART still don't work with flashburn : ( 

     

    Eric Fang said:

    Dear Matt,

    I study the UART code under the directory you refer, and I copy one of the uart API to my project in main( ), and it works!!

    Really appreciate your help!!

     

    Please refer to the following for the code I add:

    void DM6431_UART_open( Uint32 baudrate )
    {
        UART_Handle uart_handle;
        Uint32 divisor;

        divisor = 27000000 / ( baudrate * 16 );

        uart_handle = ( UART_Handle )&UART_MODULE_0;
        uart_handle->regs->PWREMU_MGMT = 0;     // Reset UART TX & RX components

        _wait( 100 );

        uart_handle->regs->DLL = ( divisor & 0xff );    // Set baud rate
        uart_handle->regs->DLH = ( divisor >> 8 ) & 0xff;

        uart_handle->regs->FCR = 0x0007;        // Clear UART TX & RX FIFOs
        uart_handle->regs->FCR = 0x0001;        // Enable TX & RX FIFOs 1-byte
        uart_handle->regs->IER = 0x0007;        // Enable interrupts
        uart_handle->regs->LCR = 0x0003;        // 8-bit words,
                                                // 1 STOP bit generated,
                                                // No Parity, No Stick paritiy,
                                                // No Break control
        uart_handle->regs->MCR = 0x0000;        // RTS & CTS disabled,
                                                // Loopback mode disabled,
                                                // Autoflow disabled

        uart_handle->regs->PWREMU_MGMT = 0x6001; // Emulation Free,
                                                 // Enable TX & RX componenets
    }

    Best Regards,

     

    Eric Fang

     

     

     

     

     

     

  • It's working now!!

    Add this line EVMDM6437_init(); before using UART.

    :  )