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

Adding a printf statements causes a failure in flash download

I am using the uVision 3 (demo) with the ULINK debug module on a board which uses the Infineon XC167 microcontroller. We have an external flash as well.
I have a small program that increments a value and then uses a printf statement to send it to the serial port. This can then be viewed in hyperterminal.
The problem is if I set the board and the flash download utilities to use internal flash memory (on the XC167), the program runs fine. If I change the settings on the board and flash utilities (and other register setups of course) to use external flash, the error message "Error: Flash Download Failed" appears when I try to load the target. Remove the printf statement and everything works fine in external flash. The same is true for the putchar routine (printf uses this).
I've checked the generated code size and as far as I can tell we are under the 4K demo limit.

This doesn't make any sense to me. It shouldn't make any difference where the code resides. Has anyone seen this?

Thanks in advance.

-Les

Parents
  • Hi Les,

    we got the same problem with an starterboard for XC16x devices from TQ, if we used a multiplexed bus mode and access to external flash.
    The problem was that our routines works fine in internal memory, but crashed the debugger
    session if we accessed the external one.

    The reason was the dip switch setting on
    switch 101 and wrong value in EBCMOD1 register.

    The value for the EBCMOD1 register had to be
    0x003F , but was 0x000F.
    At this time there was a mistake by taking values generated from DAvE into µVision.
    This should be now solved, so far as I know.

    Dip 101 -> 2+3 = ON --> Causes an error
    Dip 101 -> 6+7 = ON --> It works.

    If you have such a board, I can try to provide you with settings we use.

    Stefan
    - Thanks to KEIL support, help us to find this problem -

Reply
  • Hi Les,

    we got the same problem with an starterboard for XC16x devices from TQ, if we used a multiplexed bus mode and access to external flash.
    The problem was that our routines works fine in internal memory, but crashed the debugger
    session if we accessed the external one.

    The reason was the dip switch setting on
    switch 101 and wrong value in EBCMOD1 register.

    The value for the EBCMOD1 register had to be
    0x003F , but was 0x000F.
    At this time there was a mistake by taking values generated from DAvE into µVision.
    This should be now solved, so far as I know.

    Dip 101 -> 2+3 = ON --> Causes an error
    Dip 101 -> 6+7 = ON --> It works.

    If you have such a board, I can try to provide you with settings we use.

    Stefan
    - Thanks to KEIL support, help us to find this problem -

Children
  • Hi Stefan,

    We're actually using a board that we designed. It uses an Atmel AM29F160D which uses a 16 bit demultiplexed address/data scheme therefore the EBCMOD1 is 0x0000.

    I'm able to run from external flash in general. The only exception is when I add the printf statement, then I get the Flash download failure.

    I'm hoping this is simply a problem with the demo version. We've purchased the PK166 package and will have it up soon.

    I appreciate the information though.

    Thanks,
    Les

  • Hi Les,

    good idea to try the new version.
    The problem I described was for printf().
    All other stuff we were able to run from external memory too.

    Please leave a message, if your problem is solved ( or even not ).

    Stefan