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.

eCAN bootloader TMS320F2809

Other Parts Discussed in Thread: TMS320F2809, CONTROLSUITE, TMS320F28069

Hello,

I'm working with TMS320F2809.

I already used it for some project and I know about some driver.

I used to download a bootloader with SDFLASH but the fact is I can't run SDFLASH on a windows 7 machine. So, I use a windows XP machine with usb to serial adapter (I pull up or down the correct GPIO).

So, I decided to developped my own application (c#) which use the CAN bus to download a bootloader faster.

As mentionned on SPRU722C datasheet :

- I did my boot table with hex2000 Projet.out -boot -gpio8 -a (also tried  hex2000 Projet.out -boot -can8 -a but it seems to be the same)

- I'd configured my bus can at 500kb/s 2 bytes ID1

- I send message like it is said (0xAA and then 0x08)

But in my case it happened nothing...

My programme is a blinky LED on GPIO23 and may be my problem come from F2809.cmd file.

Somebody can help me please?

Thank you

  • Any reply?

    I still havve this problem and I think it could be the same for others family devices

  • Hi,

    Are you using the ROM bootloader and a C# PC application to talk with that CAN bootloader in ROM? Are you able to load the blinky application?

    Make sure your blinky project runs from RAM.

    sal
  • Hi,

    I'm using the ROM bootloader and a c# application to talk with the CAN bootloader in ROM.

    Which Blinky project are talking about? I tried some project but it seems to not worked properly.

    How can I be sure that my blinky project is correctly running from RAM?

    Thank you Sal

  • there is a blinky example project in controlSUITE. If you are using a controlCard, an LED should be blinking. If you are not, then check to see what GPIO should be getting toggled, and scope the pin to confirm it is being toggled.

    sal
  • Hi Lemoine,

    + to what Sal said.

    Before you start to debug the bootloader itself, you need to be 100% sure that the code you are trying to load is fine and that the datastream is fine. If it's a custom hardware, you should also verify that the hardware is fine (GPIO levels are for CAN bootload, CAN transceiver is ok, etc.).

    You say you have LED on GPIO23. So for this, my suggestion would be to go for a Controlsuite example, import one such as cpu_timer. Scroll down the code to the 3 cpu interrupts, put these lines inside one of the interrupts:

    EALLOW;

    GpioDataRegs.GPATOGGLE.bit.GPIO23 = 1;

    EDIS;

    *maybe EALLOW/EDIS is not required, I don't remember but won't harm anyway.

    Burn this code, check that your LED is toggling every second. Then go for Project->Properties->Build go to the Step tab and add to the Post-Build steps following command: "${CG_TOOL_HEX}" "${BuildArtifactFileName}" -boot -can8 -a -o "${BuildArtifactFileBaseName}.txt", this way after each time you build your code in the project folder (inside the Debug folder) CCS will produce .txt file that you should use to burn your code with CAN. Or use your hex2000 tool instead.


    This way you will be sure that your code is fine and that the data stream in the .txt file is fine. So now you are alone with your C# application :)

    Btw, what type of CAN transceiver you use on a PC side? Have you checked simple CAN communications with MCU? I personally used a PEAK CAN-USB transceiver. But not for a bootloading.

  • Let's try it together...

    First of all I import the CpuTimer Project example which is located on C:\tidcs\c28\DSP280x\v170\DSP280x_examples\cpu_timer.
    I added "GpioDataRegs.GPATOGGLE.bit.GPIO23;" on cpu_timer0_isr and
    GpioCtrlRegs.GPADIR.bit.GPIO23 = 1; // 0 = input; 1 = output
    GpioCtrlRegs.GPAMUX2.bit.GPIO23 = 0;
    GpioDataRegs.GPACLEAR.bit.GPIO23 = 1;
    in the begening to initiate correctly the GPIO and to toggle it.

    So now, I want to run it on my demoboard. I configured CCS like this : Project\properties\CCS General\ Variant : Experimenter's Kit - F2808 and Connection Texas Instruments XDS100v1 USB Debug Probe.

    I did this for all of my project.

    I think my problem could begin from here. Indeed, when I compiled I have some errors like #10010 and #10263. So, I excluded from build some .cmd files but I still have some errors or warning.

    In this project I have 2808_eZdsp_RAM_Ink.cmd, 2808_RAM_Ink.cmd, DSP280x_Headers_nonBios.cmd.

    What am I supposed to do with these files?

    Thank you guys (-:
  • Yes, trying together is always fine :)

    My first question is: which version of CCS and ControlSuite you are using? And the second goes right away: what hardware are you using? Is it some custom PCB?

    Normally, if you are using 28069 processor, you would need to import a project from f2806x folder. Mine path, for example, is C:\ti\controlSUITE\device_support\f2806x\v150\F2806x_examples_ccsv5\cpu_timer

    I omitted GPIO initialization stage. Nice that you noticed and fixed that. To run this simple example project you need only two command files. One is 28069_RAM_lnk.cmd and the other is F2806x_Headers_nonBIOS.cmd

  • I am using CCS 5.5.0.00077 and I don't know the version of ControlSuite but I downloaded it few time ago.
    To test my code/program I am using a demoboard developped by TI which is an "Texas Instruments Docking stn USB-EMU [R3]" in which I plugged an other board which have an TMS2808.
    Then my program seems to be "good" I download it on a custom board which used a 2809.

    In debuf mode it seems the gpio didn't toggled but when I restarted the demoboard it works. As you said I used 2808_RAM_Ink.cmd and DSP280x_Headers_nonBios.cmd.

    Now I have to erase all the flash and tried to download my program. I have to add your previous command may be.

    (I used a CANUSB from http://www.can232.com/)
  • Some news (bad and not)...
    I erased the DSP with SDFLash and then I tried to download my program with the CAN.
    After all the message has been send the LED was blinked (this is the good news).
    But now I can't erase the flash with SDflash but it seem's I still can download the program with the CAN.
    Then (another bad news) when I restart the board with the correct pin anything is blinking.
    :-(
  • ok sorry to disturbed I can erased the flash my com Port was too busy :-s
  • So, you ended up with... ?

    Don't forget to switch .cmd files when you switch from your 2808 processor to 28069. I have no idea what a 2808 processor is, but I'm quite sure that TMS320F28069 won't be happy with it's .cmd files (use thoses I named in my previous post).
  • Hi,

    it stil doesn't work well.

    I have some trouble to erase the flash and the main problem is after sending my program by CAN bus the LED is blinking but when i restart the board the LED is not blinking.

    I'll tried to find the 2809.cmd file.

  • Hi,

    1) Make sure you reconfigured your hardware after loading program via CAN. If you selected Booloader option to boot via CAN then after each reset or each power-up your MCU won't start your code and instead will run CAN botload mode again, waiting once again for you to send a code via CAN.

    2) For a 28069.cmd files and all others you need to update your ControlSuite. Get the latest version!
  • I'm sure I reconfigured my hardware because the selection boot mode is made by some switch on the board.

    hum,... why are you talking about the 28069.cmd? My target is a 2809

    Is it helpful if I post my memory.map?
  • Oh god... The whole thread I thought it was about 28069.... Sorry for that.

    I wish I could be more helpful :(

    Btw, have you tried the same flash code on your demo board, does it work after restart there? (of course with appropriate command files)

  • No problem :) may be it's the same issue

    Yes it work after restart
  • still doesn't working... )-:
  • attached the memory.map and .cmd files

    CanBoot.zip

  • LEMOINE,

    According to the files you have attached, you are using RAM command file. Then there is no wonder that your code doesn't work after restart if you configured the hardware to boot from flash. You need to build your project in flash first, using the flash command file. F2809.cmd should be the name or something similar.
  • Hi,

    ok so the problem is here.

    I tried your solution but it still doesn't work and may be it's worth.

    I download the bootloader and any LED is blinking and it's the same after restarting the board

    So attached my new files

    CanBoot2.zip

  • LEMOINE,

    Using flash command file is only one step to prepare your code for flash memory. Have you also accomplished other necessary steps? Have you included FlashInit(), memcopy, etc. in your program code?

    If not, I can give you a very quick and dirty guide how to do it. Just tell me.
    Otherwise - for a more detailed description - look at SPRA958L and SPRAAU8

  • May be your "very quick and dirty guide" could be very helpful... :)

    I have to check my code but I don't think I added these stuff.

    (My name is Alexandre :) )
  • Alexandre,


    For my latest projects (using the latest ControlSuite version) I do the following to transfer my code to flash (of course, when I'm satisfied with the default flash command file, my program fits, etc.):

    1) Add the flash command file to the project and exclude the RAM command file (you have already done it).

    2) Add the following lines of code (after the InitPieVectTable()):

    // Copy time critical code and Flash setup code to RAM
       memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (Uint32)&RamfuncsLoadSize);
       InitFlash();

    3) Make sure your can compile your code and you have no warnings.

    *) I used to also do the following: go to Project properties -> Build -> C2000 Compiler -> Advanced Options -> Predefined Symbols and add a "_FLASH" symbol there. I used it in some of my previous projects. Not sure if you need to do this step. Maybe some TI experts will advise.

    You can also check the example project. Example_2809_Flash (I believe that is the name) to see all steps in details.

  • 1) seems to be ok but I didn't change anything on these files

    2) This is my main function :
    void main(void)
    {

    // Step 1. Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    // This example function is found in the DSP280x_SysCtrl.c file.
    InitSysCtrl();

    // Step 2. Initalize GPIO:
    // This example function is found in the DSP280x_Gpio.c file and
    // illustrates how to set the GPIO to it's default state.
    // InitGpio(); // Skipped for this example
    // GPIO23 LD_ALIVE
    EALLOW;
    GpioCtrlRegs.GPADIR.bit.GPIO23 = 1; // 0 = input; 1 = output
    GpioCtrlRegs.GPAMUX2.bit.GPIO23 = 0;
    GpioDataRegs.GPACLEAR.bit.GPIO23 = 1;
    GpioCtrlRegs.GPADIR.bit.GPIO21 = 1; // 0 = input; 1 = output
    GpioCtrlRegs.GPAMUX2.bit.GPIO21 = 0;
    GpioDataRegs.GPACLEAR.bit.GPIO21 = 1;
    EDIS;

    // Step 3. Clear all interrupts and initialize PIE vector table:
    // Disable CPU interrupts
    DINT;

    // Initialize the PIE control registers to their default state.
    // The default state is all PIE interrupts disabled and flags
    // are cleared.
    // This function is found in the DSP280x_PieCtrl.c file.
    InitPieCtrl();

    // Disable CPU interrupts and clear all CPU interrupt flags:
    IER = 0x0000;
    IFR = 0x0000;

    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR).
    // This will populate the entire table, even if the interrupt
    // is not used in this example. This is useful for debug purposes.
    // The shell ISR routines are found in DSP2834x_DefaultIsr.c.
    // This function is found in DSP2834x_PieVect.c.
    InitPieVectTable();

    // Copy time critical code and Flash setup code to RAM
    // This includes the following ISR functions: epwm1_timer_isr(), epwm2_timer_isr()
    // epwm3_timer_isr and and InitFlash();
    // The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
    // symbols are created by the linker. Refer to the F2808.cmd file.
    MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);

    // Call Flash Initialization to setup flash waitstates
    // This function must reside in RAM
    InitFlash();


    // Interrupts that are used in this example are re-mapped to
    // ISR functions found within this file.
    EALLOW; // This is needed to write to EALLOW protected registers
    PieVectTable.TINT0 = &cpu_timer0_isr;
    EDIS; // This is needed to disable write to EALLOW protected registers

    // Step 4. Initialize all the Device Peripherals:
    // This function is found in DSP280x_InitPeripherals.c
    // InitPeripherals(); // Not required for this example
    InitCpuTimers(); // For this example, only initialize the Cpu Timers

    // Configure CPU-Timer 0 to interrupt every second:
    // 100MHz CPU Freq, 1 second Period (in uSeconds)
    ConfigCpuTimer(&CpuTimer0, 100, 1000000);
    StartCpuTimer0();

    // Step 5. User specific code, enable interrupts:


    // Enable CPU INT1 which is connected to CPU-Timer 0:
    IER |= M_INT1;

    // Enable TINT0 in the PIE: Group 1 interrupt 7
    PieCtrlRegs.PIEIER1.bit.INTx7 = 1;

    // Enable global Interrupts and higher priority real-time debug events:
    EINT; // Enable Global interrupt INTM
    ERTM; // Enable Global realtime interrupt DBGM

    // Step 6. IDLE loop. Just sit and loop forever (optional):
    for(;;);

    }

    3) I can compile but since the beginning I have some warnings
    Build variable 'XDAIS_CG_ROOT' cannot be resolved.
    #10063-D entry-point symbol other than "_c_int00" specified: "code_start"
    Invalid project path: Include path not found (\packages\ti\xdais).

    I read some thread and it seems that these warnings are not important.

    So now I see any changement...

    Have you got any simple program which work?
    Thank you ;-)
  • Alexandre,

    Your code looks perfectly fine for me. Does it (with appropriate command files) work on your test demo board with 2808 processor?

    P.S. I Guess, and that is a very bad guess, that it's not possible to load code to flash via default CAN bootloader. It is necessary to use something similar to flash kernel.

  • Yes it works on my demo board!

    too bad :(
  • So, is there any chip solution other than SDFLASH+WINXP+RS232 ?
  • Sorry Alexandre.

    I have no experience with 280x devices, so I don't know how to help you further.

    On other devices from C2000 family (2806x family for example) I would suggest you to take a look at flash kernel. Try it and implement something similar via CAN. It's not a piece of cake though.

    Maybe Sal Pezzino can help. He is one of the authors of Flash programming solution and a nice person overall.

    I wish you all the best of luck with your project.

  • Thank you Andrei,

    I spent too much time on this issue so I don't want to try another hard solution.

    I hope Sal Pezzino could help me