1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Write custom flash programming function for TMS320F2812?

Discussion in 'Embedded' started by Bill, Nov 13, 2007.

  1. Bill

    Bill Guest

    Hello all

    I want to be able to write custom C-code for an TMS320F2812 DSP that enables
    me to flash program the DSP through several different ports (SCI-A, SCI-B,
    CAN-A, and maybe other ports to).

    I have an idea how I would want it to work. Let's say that flash sector A
    holds this re-flashing code. And the other sectors hold the application

    The program in sector A scans all incoming data on the different ports, and
    when it recognizes a specific sequence in one of them it jumps to a flash
    programming function.

    Have any of you done something similar?

    How do I manage the two different programs (the flash programming function
    and the application), should I use two projects. And how do I use them
    Bill, Nov 13, 2007
    1. Advertisements

  2. 1) Load and execute a small application in the RAM whose
    responsibility will be to identify if it
    is either the Application or the Flash Programming application and
    load it in RAM.
    By this technique, you can make the application to get copied to the
    RAM from the correspoding
    sector in Flash Memory and you can also make the Flash programming
    function to get copied to
    the RAM and execute from there.
    Care should be taken for avoiding the overlap of Memory of these 2
    different programs in
    the RAM . (This can be done by changing the Linker Scripts / Linker
    Command FIle(LCF) ).

    By placing both these programs in RAM in different locations within
    RAM memory , it is possible
    to use them together.

    2) You can also try XIP (Execute in Place) functionality for the
    application whose responsibility
    will be identify if it is either a Flash Programming Function or
    Application . But, here the
    application should be in the Flash Memory itself.

    Karthik Balaguru
    karthikbalaguru, Nov 13, 2007
    1. Advertisements

  3. You just want to be able or you want the actual code?
    Why not.
    I developed the flashloader for 28xx, as well as for many other MCUs.
    1. At reset, the control is given to the flashloader part.
    2. The flashloader verifies if the application part is valid.
    3. If the application part is valid, then the control is given to the
    4. If the application is not valid, we stay in the flashloader.
    5. Application can unvoke the flash programming part at any time.

    Vladimir Vassilevsky
    DSP and Mixed Signal Consultant
    Vladimir Vassilevsky, Nov 13, 2007
  4. Bill

    Jack Klein Guest

    You can download the flash programming API from TI's web site. You
    write calls to this code according to the documentation and link the
    provided library into the code.
    You can't execute code from the flash while you are erasing or
    programming any part of the flash. You need to copy your programming
    code into internal RAM to run it.

    Start on this web page:

    ....from there you can find links to application notes and sample
    source code.
    Yes, of course. We have boards where we use the 2812. We split the
    flash into two parts, a small part for boot code (we call it a BIOS),
    and a larger part for the application.

    The BIOS performs power on self tests, and can communicate with higher
    level controllers in the system, via CAN which we use in our system.
    The BIOS will accept a new image for programming into the DSP flash,
    or a different image for programming into other programmable devices
    on the board.

    In our case, we have 128K x 16 bit external RAM on the board, the same
    size as the flash, so it can receive the entire new flash image and
    verify its checksum before running code from internal RAM to erase and
    reprogram the flash. By having the entire new image in on-board
    external RAM, it significantly reduces the amount of time where a loss
    of power could leave the flash in an unusable condition.
    Once the BIOS self tests determine that everything on the board is
    functioning properly and there is a good image in the application part
    of the flash, it jumps to a predefined address in that image. If any
    of the self tests fail, or if a push button on the board is held
    during reset, it remains in the BIOS code.

    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://c-faq.com/
    comp.lang.c++ http://www.parashift.com/c++-faq-lite/
    Jack Klein, Nov 14, 2007
  5. Flash Memory is organised into many blocks/sectors.
    So, Why is not possible to execute(XIP) in one part(block/sector) of
    the flash while
    other part(blocks/sectors) of flash memory is getting erased/
    programmed ?
    Any specific reason w.r.t Flash Memory design ?

    Thx in advans,
    Karthik Balaguru
    karthikbalaguru, Nov 14, 2007
  6. TI 28xx flash API is crap. It is the brain dead blocking code with disabled
    interrupts which relies on the delays generated by the dummy loops in the
    software. It is not very difficult and much more flexible to access the
    flash programming registers at low level by your own program.
    The flash programming (erasing, to be more specific) is so slow on 28xx... I
    wonder why.
    Since it is not safe to reflash the flashloader itself, I usually try to
    keep the functionality of the flashloader at minimum. Just the communication
    part and the integrity check of the application code. To avoid the
    accidental corruption of the flash, the actual flash programming code is
    *not* included into the flashloader, but loaded into RAM from the outside.

    Vladimir Vassilevsky
    DSP and Mixed Signal Consultant
    Vladimir Vassilevsky, Nov 14, 2007
  7. Bill

    Bill Guest

    What if the downloaded code to the DSP flash is fubar and it locks the DSP?
    Then the custom code can't run?

    The only safe way I think is to have a second microcontroller that programs
    the DSP.
    Bill, Nov 16, 2007
  8. 1. The flashloader checks the CRC of the application code before
    starting it.

    2. Even if the application code is valid, the flashloader retains the
    control for some short time. So the application can be reflashed if

    3. You can put a jumper on the board to force or to disable the

    4. The actual flash programming code is neither the part of application
    nor the part of the flashloader. This code is loaded from the outside
    only at the time of the flash programming. This prevents the accidental
    corruption of the flash because of a glitch, a software bug, etc.
    Who will guard the guards?

    Vladimir Vassilevsky
    DSP and Mixed Signal Design Consultant
    Vladimir Vassilevsky, Nov 16, 2007
  9. Bill

    Bill Guest

    The guard is not erasable :)

    Bill, Nov 16, 2007
  10. But the guard can kill the master by an accident.

    Vladimir Vassilevsky
    DSP and Mixed Signal Design Consultant
    Vladimir Vassilevsky, Nov 16, 2007
  11. Bill

    Maria Minhas

    Dec 18, 2015
    Likes Received:
    Hi I would like to learn how you can write into external RAM specially at a specific location using DATA_SECTION.
    Maria Minhas, Dec 18, 2015
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.