No serial output with CW 8.8 and 8313E-RDB using USB TAP and FreeSCale PowerPC EABI Linker

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

No serial output with CW 8.8 and 8313E-RDB using USB TAP and FreeSCale PowerPC EABI Linker

2,329 Views
drnewman
Contributor I
I am not receiving the serial output I would expect with CW8.8 Build 70829 and the MPC8313E-RDB.

I have created a new project using CW with the following settings:

EPPC New Project Wizard
Linker -                       FreeScale PowerPC EABI Linker
Processors -              PowerPC8313
Board -                       8313 RDB
Languages -               C
Remote Connection - CodeWarrior USB TAP

I have setup Hyperterminal with the following settings as described in the file 8313_RDB_README.TXT:
Baud Rate: 57600
Data Bits: 8
Parity: None
Stop Bits: 1
Flow Control: None

No output occurs to Hyperterminal when the printf in the program occurs.

The serial cable is connected to UART1 on the RDB8313E-RDB.
The serial port works ok when the board is booted with uboot and hyperterminal is set to:
Baud Rate: 115200
Data Bits: 8
Parity: None
Stop Bits: 1
Flow Control: None
Labels (1)
0 Kudos
2 Replies

394 Views
Black
Contributor I
Some 8313RDB REVA3 and all later boards have 33 MHz instead of 66 MHz as the clock input (check your board U15 oscillator marking).

The UART library from CodeWarrior is built for the 66MHz value. If your board has a 33MHz oscillator, you have to rebuild the UART library.
Go to: {CW_Install_dir}\PowerPC_EABI_Tools\CodeWarriorTRK\Transport\processor\ppc\serial\8313_RDB_serial
Open the mcp project, open duart_config.c; in the GetSystemClock () change systemClock value to 33 and re-build your library. Then use this rebuilt library in your project.
 
If the problem continues, please log a service request here.
 
I hope this helps,
Black
0 Kudos

394 Views
drnewman
Contributor I
Changing the value from 66 to 33 fixed my problem at 57600 baud.

I then attempted to have the UART run at 115200 baud like UBoot and Linux that are on the board are using.

I changed UART_CONSOLE_BAUD_RATE from kBaud57600 to kBaud115200 in uart_console_config.h

This did not work since the baud rate is not calculated exactly enough by GetClockDivider in duart_config.c
The divider is calculated as 85 rather than the correct value of 89.

I changed the original code in GetClockDivider from the following:

    tempVal = (RCWLR_Reg & 0x0F000000)>>24;
    clockDivider = (systemClock * 1000000) /(16 * baudRate);

    switch (tempVal) {
        case 0://0x0000:
            clockDivider *= 16;
            break;
        case 2://0x0010:
            clockDivider *= 2;
            break;
        case 3://0x0011:
            clockDivider *= 3;
            break;
        case 4://0x0100:
            clockDivider *= 4;
            break;
        case 5://0x0101:
            clockDivider *= 5;
            break;
        case 6://0x0110:
            clockDivider *= 6;
            break;
        case 8://0x1000:
            clockDivider *= 8;
            break;
        case 9://0x1001:
            clockDivider *= 9;
            break;
        case 10://0x1010:
            clockDivider *= 10;
            break;
        case 11://0x1011:
            clockDivider *= 11;
            break;
        case 12://0x1100:
            clockDivider *= 12;
            break;
        case 13://0x1101:
            clockDivider *= 13;
            break;
        case 14://0x1110:
            clockDivider *= 14;
            break;
        case 15://0x1111:
            clockDivider *= 15;
            break;
        default:
            break;
    }

to the following:

    tempVal = (RCWLR_Reg & 0x0F000000)>>24;
    switch (tempVal) {
        case 0://0x0000:
            systemClock *= 16;
            break;
        case 2://0x0010:
            systemClock *= 2;
            break;
        case 3://0x0011:
            systemClock *= 3;
            break;
        case 4://0x0100:
            systemClock *= 4;
            break;
        case 5://0x0101:
            systemClock *= 5;
            break;
        case 6://0x0110:
            systemClock *= 6;
            break;
        case 8://0x1000:
            systemClock *= 8;
            break;
        case 9://0x1001:
            systemClock *= 9;
            break;
        case 10://0x1010:
            systemClock *= 10;
            break;
        case 11://0x1011:
            systemClock *= 11;
            break;
        case 12://0x1100:
            systemClock *= 12;
            break;
        case 13://0x1101:
            systemClock *= 13;
            break;
        case 14://0x1110:
            systemClock *= 14;
            break;
        case 15://0x1111:
            systemClock *= 15;
            break;
        default:
            break;
    }
    clockDivider = (systemClock * 1000000) /(16 * baudRate);

This changed code now calculates the correct value of 89 and 115200 baud is now working for me in all cases.

The original code performed the following calculation
res = (33 * 1000000) / (16 * 115200)
      = 33000000 / 1843200
      = 17 (since integer math truncates)
This is then multiplied by 5  resulting in a value of 85 for the divider

The new code performs the following calculation
res = (5 * 33 * 1000000) / (16 * 115200)
      = 165000000 / 1843200
      = 89 (since integer math truncates)
0 Kudos