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.

InstaSPIN FOC : how to program in Flash

Other Parts Discussed in Thread: DRV8301, MOTORWARE

Hello all,

I'd like to switch my project to standalone mode i.e run without the pc connection. My board is a DRV8301 rev D with an F2806v ISO card. I am using XDS100v2 emulator for programming.

First I defined the FLASH symbol but this is what I get when compiling :

<Linking>
"R:/software/TI/MotorWare_1_01_00_09/sw/ide/ccs/cmd/f2806x/f28069F_ram_lnk.cmd", line 107: error #10099-D:
   program will not fit into available memory.  placement with
   alignment/blocking fails for section "ramfuncs" size 0x6df page 0.
   Available memory ranges:
   RAMM0        size: 0x3b0        unused: 0x2ee        max hole: 0x2ee     


 undefined first referenced
>> Compilation failure
  symbol       in file     
 --------- ----------------
 _memCopy  ./eBike_v2.obj  

error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "eBike_v2.out" not built
gmake: *** [eBike_v2.out] Error 1

It looks like there is not enough space in memory but I suspect that I am just missing something. I replaced f28069F_ram_lnk.cmd with the f28069F.cmd  with no effect.

  • Hello!

    1) For common understanding I would recommend you this AR 6254.TI_Running_from_Flash_spra958l.pdf and this link http://processors.wiki.ti.com/index.php/C28x_Compiler_-_Understanding_Linking.

    2) In general you need to do the following:

    - define "FLASH" in "Predefined symbols" of project's properties;

    - add to project the ROM (Flash) version of CMD file instead the RAM version (and don't forget about XXX_headers_nonBIOS.cmd or XXX_headers_BIOS.cmd depending on using DSP/BIOS in your project );

    - add to project CodeStartBranch.asm file.

    3) I would recommend you to update motorware up to 1_01_00_11 version.

    Regards,

    Igor

  • Angelo,

    Please download latest MotorWare version 11. Starting with version 10 all projects were set-up to be able to be built and run in standalone Flash mode. Simply right click the project and select the FLASH active build configuration.

  • is it possible to flash the chip using XDS100v2 usb emulator or is it necessary to have a JTAG ?

  • It is possible.

    Best regards,

    Maria

  • Angelo,

    the XDS100v2 is a JTAG emulator.  Any JTAG emulator will allow you to load a program to the chip (Flash or RAM).  There are also serial programmers that use a UART if you like.

     

  • I already tried it and it works. I used the FLASH configuration in a motorware 11 project and I went through all procedure (erase and program flash ) successfully. The code runs normally with USB connected but it fails to reboot without it. DIP switches on my board are in their default position (according to manual in Boot from Flash position).

    Am I missing something ?

  • Which DIP switch settings are you using on which controlCARD? I would triple check these.

    If you are using MotorWare _11 you should have the CodeStartBranch.asm included in your project once you set this active build configuration to FLASH. Double check this is true as this is the file that allows the proper boot to flash on reset.

    In your user code are you automatically setting the Enable, UserParams, and Run flags so your motor will actually start spinning?

     

  • My control card is the F28069 ISO and SW1 is in its default position (ON - ON Get mode boot from Flash). I can see CodeStartBranch.asm file in the project explore going active when I select configuration -> Flash.The project compiles as it should.

    Enable and Run flags are set/reset using start and stop buttons. It works perfectly with the debugger on.

  • Hello Angelo,

    SW3 that you should concern, not SW1.

    Put it OFF as I remember, to make it as standalone flash.

    Best regards,

    Maria

  • My board is F2806x ISO control card Release 0.2. The rightmost switch has a notation SW1 BOOT. According to manual (qsg_hw_cncd28069miso.pdf)  SW3 is TRST/ISO SCI communication signal enable. Are you sure ?

  • Yes, I am.

    I meant, you should concern about SW3 too, not only SW1.

    Please refer to the F28069M ISO HW documentation. This SW3 (position 1) is to open/close the communication with TRST (JTAG).

    If you keep it ON, then you will run using JTAG.

    Best regards,

    Maria

  • thanks for your reply.

    This is what I did :  

    SW1 to ON-ON (default).  SW3 (1) to OFF

    - Swithced the project to Active - Flash

    - Clean and rebuild my project.

    - Debug (successfully went through erase sectors and program ).

    - Enabled real time mode and pressed Resume/Run  - The program didn't ran.

    - I pressed pause to see what part of code is been executed -  I got the message Error reading Register PC

    - I tried to reboot the board several times since it is supposed that code was already in Flash, with USB on or off but with no effect.

    Any ideas ?

  • Should I program the board with SW3 (1) in ON or OFF position ?

  • A quick update: Although in flash configuration FLASH wasn't defined in predefined symbols. I've just added it. I don't get the Error reading Register PC message and I can run my app using the USB cable but still does not start without it.

  • Hello,

    If you want to upload or debug your firmware (FLASH or not), you need to put SW3 ON because this is the connection to JTAG emulator.

    If you want your MCU to run as standalone flash (means, you can run without your USB JTAG connected), then you need to switch SW3 OFF. You can unplug and plug your board power supply and your board will run without JTAG emulator.

    Which one that you need?

    Best regards,

    Maria

  • This is exactly what I've done but the board doesn't boot if I recycle the power source. I programmed CPU with SW3 in ON position, removed the power, switched SW3 to OFF and rebooted without the USB.

    The flash memory is programmed correctly. I know this because I can successfully boot the board moving SW3 back to ON position and just plug and then unplug the USB connector. Flash is correctly programmed but CPU doesn't boot after power up regardless the SW3 position. Is there anything else that I can try ?

  • Hi Angelo!

    Could you please upload your project according the following instruction:

    1. File -> Export
    2. Expand "General" and select "Archive File". Click "Next"
    3. The dialog that appears allows you to select which projects you wish to export to the archive. When you select a project it will show you on the right hand side all of the items it is going to export. Check the box beside the project to indicate that you want to archive it.
    4. Specify a name for your archive and select either zip or tar, then click "Finish"
    Regards,
    Igor
  • Hello Angelo,

    Can you give us your .map? Or you can check by your self that your code is really in flash.

    I am not sure in Motorware v11 how to set the project to run in flash.

    As I remember, in Motorware v9 that I used, I did these steps to make my code run in FLASH:

    1. I added memCopy.c

    2. I added F28069F.cmd and F2806x_Headers_nonBIOS.cmd

    3. I removed F28069F_ram_lnk.cmd

    4. I defined FLASH in project properties

    5. I added CodeStartBranch.asm

    6. I checked whether flash has been setup (initialize) in the code or not

    7. I set the boot switch in my controlcard to be flash boot mode

    (you can see also http://e2e.ti.com/support/microcontrollers/c2000/f/902/p/300793/1048859.aspx#1048859)

    I haven't tried any example from Motorware v11 yet because my hardware is not available this time to try it.

    Hope you can get the solution soon.

    Best regards,

    Maria

  • ok it is fixed. The last missing thing was the FLASH definition. Since then, my code was in flash actually but since I've made modifications in pin mux in order to activate pot, start/stop buttons and external i/os accidentally i changed an io that I shouldn't, blocking somehow the processor restart. 

    Thanks a lot for your help.

  • OK, glad to know.

    Cheers!

    Best regards,

    Maria