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.

UART Problem after system reset

Hey guys...

I've got a problem with my uart after pushing the system reset button in CCS. The bootmode configuration of my eval board is in default mode, so the HUA-Demo starts after power up and I can observe some messages from the HUA-Demo in the terminal. Then I'm loading my own code to one of the cores, setting the UART clk divider registers to configure the BAUD rate and sending some debug messages. So far, everything is fine! The messages appear in the terminal!

But now I'm pressing the system reset button of CCS, loading the same code to the device, and the debug messages are no longer appearing in the terminal!

What am I doing wrong? Did I forget some initializations?

I've written the UART code by myself, but this works fine with other ti-devices. I also called the GEL-Script Global_Default_Setup, but this didn't fix my problem.

Regards,

Pille.

Here is my UART init code:

void initRS232(int baudRate, int FIFOmode, int HWhandshake, unsigned char stopBit, unsigned char wordLen, unsigned char parity) {

    int divisorValue;

    // calculate divisor register value (TL16C550 datasheet page 32)
    divisorValue = UART_FREQ_HZ / (baudRate * 16);

    // Access Divisor Latch Register
    LCR |= 0x80;
    FREQ_DIV_LSB = (unsigned char) (divisorValue & 0x00FF); // DIV= freq/baudrate/16
    FREQ_DIV_MSB = (unsigned char) ((divisorValue & 0xFF00) >> 8);
    LCR &= ~0x80;
    // Divisor Latch Register

    // set Line Control Register (only stop Bit, Word Length and Parity matters)
    LCR = (unsigned char) (stopBit | wordLen | parity);

    // set RTS
    MCR = 0x02;
    // enable
    FCR = 0x01;

    //init RingBuffer
    rxStart = 0;
    rxEnd = 0;
    cmdEOF = 0;
    return;
}

  • Phillip,

    Which DSP and which version of EVM and CCS are you using?

    It would be good to check the errata for your device to see if there is anything related to the UART that might be affecting your operation. I did not check it, so there might not be anything, but it is always a good idea to look there first.

    I would approach debug for something like this on my system (and I did recently on the C6424) by dumping all of the UART registers and UART-related PSC registers prior to loading your program after a POR, after successfully running your application, after the CCS System Reset, and after initialization in your reloaded application. Compare those to see what is different in the four scenarios.

    Look at the UART signals on an oscilloscope to see if anything is coming out, possibly at a different frequency.

    Regards,
    RandyP

  • Thanks for your qick reply :)

    Dumping the UART registers delivered, that my initialization does everything right... all registers are set to the same values like they are set by the HUA-Demo on power up!

    But I think I was able to isolate the problem a bit: when I power up the board and load my code to the board everything is working fine, as I described before... but when I'm calling the GEL-Script Init_PLL, I'm not receiving the messages in the terminal anymore! So I think the problem arises with the PLL-Initialization...

    Maybe anyone can help me with this issue: which SYSCLK is connected to the internal UART? Think it must be SYSCLK7, but I'am not sure about it...

  • BTW:

    I'm using the TMDSEVM6678LE Eval-Board and CCS  5.2.0.00069

  • I find that if the UART "doesn't work", it's often a sign that you're still in PLL bypass, with the whole chip running at 100 MHz.

    It's an easy one to trip over, because lots of things appear to work fine, but you're still effectively in first gear.  It's only when you try to interact with things that are independent of the core clock that you start to notice (typically the PHY in my case).  The UART baud rate is expressed as a divider of core clock so when you're in bypass it is out by a factor of 10 and the PC sees gibberish.

    The "System Reset" button always invisibly drops you back to this state on the 6678.  Booting from flash, the IBL sorts the PLL for you, and when you first start the debugger the GEL Global_Default_Setup does it.

    Therefore, after a System Reset, you ALWAYS need to re-run "Global_Default_Setup" from the GEL menus on core 0.  (Also, this only works if you're in "no boot" on the DIP switches).

    Forgive me if you know this, but it took me ages to understand why System Reset didn't seem to fix things.  Once I understood this, debugging became massively easier.

    There's another thread here, including a TI suggestion for a GEL function that does the reset and the setup in one action.

    http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/167914/617386.aspx#617386

  • Oh, the GEL Init_PLL menu item by itself doesn't work for me (YMMV) so I always use the full setup.  I think you probably want that anyway, as System Reset will have reset more than just the PLL.

  • Philipp,

    On the TI Wiki Pages is a simple app that runs on any C64x+ and later core (C674x and C66x) to tell you the clock speed of the DSP by comparing with the wall clock. You can find it here, and run it to confirm that your DSP clock is at the right value or not.

    Regards,
    RandyP

  • Thank you very much for your explanations... Even if it wasn't something new for me, it maybe could help other people, who are reading this post ;)

    My first suggestion was exactly this, a bad initialization of the PLL... but finally I found my problem: It was the initialization of the UART! I forgot to reset the UART Receiver and Transmitter! Writing 0x6001 to the PWREMU_MGMT Register finally solved my problem :)

    Thanks to everyone who tried to help!

    Regards,

    Philipp.