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.

TMS320LF2406A and TBLW

Other Parts Discussed in Thread: TMS320LF2406A

Hi!

I am trying to get the command TBLW to work on my TMS320LF2406A device.

I am using the code below, and _Iref_Table is a table 15x12 where all cells are set to 0x0006.


               LDP            #m_gs_TorqueRef >> 7 
               LACL           m_gs_TorqueRef
               LACL           #3
               ADD            #_Iref_Table               
               TBLW           m_gs_TorqueRef

               LACL           #3
               ADD            #_Iref_Table               
               LDP            #m_pf_20k_Test >> 7
               TBLR           m_pf_20k_Test


When I run this program m_pf_20k_Test is always 0x0006, for all values of m_gs_TorqueRef.

Does anybody have worked with that instruction?

Thanks Anders

Denmark

  • Does anybody have used the TBLW instruction for the LF2406A DSP? I am down to the quistion if it is working at all?

     

    Anders

    Denmark

  • I use the TBLR/TBLW instruction in LF2407A code.So it definitely working on that device! :-)

    The only thing I could think of is that the RAM-memorybank (DARAM?, SARAM?)

    holding _Iref_Table is not mapped to your programspace.

     

    Markus

     

     

     

  • Hi!

     

    Hmm... it is still not working.. Is there any registers that I have to setup before writigt to the Flash? Or what about the flash array/ flash regs?

    I am using the _Iref_Table for Table lookup (TBLR) and it is working fine for pre programmed tables.

     

    Anders

  • Anders,

    You cannot write directly to a flash location with going through flash programming steps.  TI offers a flash API, a library of functions to help with this process.  You can find this information at this location:  http://focus.ti.com/docs/toolsw/folders/print/sprc141.html.  All 24x flash tools are locaxted here:  http://focus.ti.com/mcu/docs/mcuflashtools.tsp?sectionId=95&tabId=1223&familyId=917.

    Probably for your case it would be better to copy the table to RAM at start-up and then work with the table out of RAM.  If you need to save the values before power-down, then program the flash table with TI's flash API. 

    If this variable is not written at a high loop-rate, then serial EEPROM is a good option as well.

    Jeff

  • Okay, I was also afraid I had to do it in that way...

    But then I have to write a whole sector at power down? It could be Sector 3 (0x7000-0x7FFF). Or can I choose a smaller array to clear, erase and program?

    But Thank you for the answer, it was very usefull

    I have also thought of a external EEPROM, but we have HW in producton, and I hope not to make more changes.

     

    /Anders

     

  • Anders,

    Using the flash API you have full control to write an individual bit, nibble, byte, word, or an entire sector of words.  Your choice.  That is one of the benefits of embedding the API in your application - you have full control over the programming process without dealing with the flash control registers themselves.

    Minimum program size = 1 bit.

    Minimum erase size = 1 sector.

    If you choose an array size less than the sector size, consider indexing through the array writing the latest copy of the array to the sector.  When the sector is full then erase the sector and write the array at the start of the sector.  Thiis is why an external EEPROM is convenient.  You load RAM at startup with the table from EEPROM, use the table from RAM and then save it to the EEPROM when you are done.  If the access time allows random access to the EEPROM, then leave the table in EEPROM and access the individual variable directly from EEPROM as needed.

    But with HW in production already, I understand it is inconvenient to change the PCB.  Time to embed the flash API into your application.

    Jeff

  • Thank you.. Great help, I will start implementing the Flash API...

     

    Anders