This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C8051F350 printf in Debug mode

Hi there,

I am new to the embedded systems and trying to learn. I have a C8051F350-DK that I wrote a
program to measure the voltage through one of the analog inputs ( I am using Keil uvision 4).
I added a printf to see the result, so I won't use the WATCH window. I downloaded the code then
debug it (through the DEBUG mode, not the Simulation mode) and it didn't work. Can anyone give
an advice if I am missing something in my settings ?? here is some of my settings :

Project > Option for target > Device > C8051F350 Use extended linker ( LX51)

Project > Option for target > Debug > Use "on the right side" \Silicon Labs C8051Fxxx Driver

Project > Option for target > Utilities > Use \Silicon Labs C8051Fxxx Driver " didn't use *.ini "

Steps: Translate -> Build Target -> Download code to flash memory -> Debug -> Run
---------------------------------------------------------------------------------------------
Thanks in advance

  • and it didn't work.

    And that's the whole description of the problem you managed to come up with. Seriously?

    Non-events contain no information, so neither does the statement "did not work" --- particularly if it's not even known what "it works" would have meant.

    So: how did you arrive at that conclusion? What did you expect to happen, what did you base that expectation on, and most importantly: what happened instead?

  • I think it's very obvious what "it didn't work" which is the printf in the debug mode. please be more polite when you answer next time. if not, I think there is other people that can help. Thanks.

  • I think it's very obvious
    i think it is NOT very obvious what you have tried

    does it work when you are not in debug mode? you do not make that clear

    does it work with the SILabs toolset?

    Keil and SILabs are frequently out of synch

  • in Keil uvision 4 : it does work in simulation mode
    in SiLbs IDE : I downloaded it successfully on the MCU and got the input voltage and Watched it through the Watch window.

  • Printf uses the serial port. You have to intialize the serial port, have something hooked up to it at the correct baudrate to capture that.

    I've been using the silabs stuff for 9 years now, and have never seen it work any other way.
    printf calls the serial putch routine if I remember correctly.

    I've never used it, when I need that functionality, I just call my serial putchar routine. BUT you have to have a serial terminal of some kind watching the line, unless you want to be a real masochist and monitor the serial line with a logic analyzer :)

  • I am using the same Example from SiLabs (F35x_UART_STDIO.c) which is basically demonstrates how to configure the C8051F350 to use routines in STDIO.h to write to and read from the UART interface. The program reads a character, outputs that character to the screen, and then outputs the ASCII hex value of that character.
    I made sure that J3 is connected (P0.4 pin to the TX signal, and P0.5 to the RX signal. Then change couple setup which are:

    Project/Option for target/Debug======>Silicon Labs C8051Fxxx Driver
    Project/Option for target/Utilities==>Silicon Labs C8051Fxxx Driver

    I set my HyperTerminal to 9600 baudrate, then I tried to download and Its saying the the port is in use. So I forget about the hyperterminal hoping to see result just from "printf" or "putchar" on the UART 1. So I download the code on the chip and debug it, but it didn't show me anything on the serial window. Did I miss any of the settings that I have to include?

    Thanks,

  • Scrungy (why a stupid monniker instead of a name), Sam

    if you read above you will see it works with the SILabs toolset

  • Because of my job. I am prohibited from using my real name. Hell, they won't even let me
    put it in the SOURCE CODE I write. :(, and made me take it out of the object file as well.

    So I picked this one a long time ago.
    I do embedded programming on Silabs processors.

  • I asked :
    does it work when you are not in debug mode? you do not make that clear

    does it work with the SILabs toolset?

    Keil and SILabs are frequently out of synch

    you answered:
    in SiLbs IDE : I downloaded it successfully on the MCU and got the input voltage and Watched it through the Watch window

    which does not answer any of my questions

    Erik

  • Erik,

    "does it work when you are not in debug mode?" Yes it does.

    "does it work with the SILabs toolset?" Yes it does.

    I am not sure anymore if printf is working or not in the DEBUG mode, so I am using HyperTerminal, but whenever I am trying to connect both of them, I can't. Its either Kiel running or Hyper Terminal. I can't run both of them. Do you have any advice about how to run both of them ? is there any option that I have to set ?

  • Erik,

    It is working now. I am getting my output on the HyperTerminal. Thanks a lot.