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.
I have been trying to use the "serial_flash_programmer" included in controlSUITE (controlSUITE\device_support\~Utilities\serial_flash_programmer) and have had some success.
I had to recompile it with visual studio, but serial_flash_programmer.exe runs fine now.
For the Flash kernel, I am using f28035_flash_kernel (controlSUITE\device_support\f2803x\v129\DSP2803x_examples_ccsv5\f28035_flash_kernel). I had to make some minor modifications. In Shared_Boot.c, the code was erasing only sectors A-D so I modified it to erase all flash sectors of an F28035
status = Flash_Erase((SECTORA | SECTORB | SECTORC | SECTORD | SECTORE | SECTORF | SECTORG | SECTORH), &FlashStatus);
Anyway, I am able to successfully load my code via:
serial_flash_programmer.exe -d f2803x -k f28035_flash_kernel.txt -a myapp.txt -p COM20 -v
at the default 9600 baud. My code (myapp.txt) is an ascii file generated by hex2000 in boot rom format, and is about 180KB.
The Kernel AutoBaud is successful, then the kernel loads and boots. Then I get a message saying Application AutoBaud is successful and then it seems to hang.
After about 1 hour, it completes and says "Application Load Successful".
Why is this taking so long?
I tried increasing the baud rate to 115200, but autobaud would not lock (and it didn't work at 57600 either), so I had to use 38400 and that seemed to work but it still took about 20-25 min.
serial_flash_programmer.exe -d f2803x -k f28035_flash_kernel.txt -a myapp.txt -p COM20 -b 38400 -v
This is just a guess, but I think it may be taking so long because of the checksum. But still, my application is only 180KB, I am not sure why this is taking so long.
I know C2Prog is an alternative but it doesn't work for my application because it uses 38400 to load the kernel, and then 115200 to transfer the application. I am using a Bluetooth module to do the serial communication and the BT module only works at one programmed baud rate, so I can't really use anything that's switching baud rates around. This is why I chose to investigate the serial_flash_programmer which seemed perfect for my application. I am sure that the BT module communicates correctly because when my application is running, I can successfully communicate through SCI via the BT module.
Hi Fulano,
Thanks for noticing we were not erasing all the sectors and glad to see you are using the serial_flash_programmer. We will fix that in the next controlSUITE release.
The Flash kernel hex file is only 6KB, and your application hex file is 180 KB. This should account for the long delay. The checksum is implemented to decrease the latency and time of communicating back to the host. Instead of echoing byte-by-byte back to the host, it sends a checksum after each block of data (maximum 0x400 words).
Increasing the baud rate may increasing the speed of loading and programming the device, but most of the time is taken up by going through the communication stack on each end (device and host).
Can you look at the characters on a scope on each end of the BT link? Are you using GPIO pins through the USB and FTDI channel for your SCI communication?... I have noticed this can increase the latency versus using an external transceiver.
And here is a link to the serial_flash_programmer App Note.
Best Regards,
sal
Hi Sal,
Thanks for your response. In addition to the flash sectors issue mentioned above, a few other things to consider in the next controlSUITE release:
-In f28035_flash_kernel (and perhaps other f280xx flash kernels), Flash2803x_API_Config.h #define FLASH_F28035 should be 1 and #define FLASH_F28033 should be 0 (although I think this may be of no consequence).
-In serial_flash_programmer, the visual studio project defaults to Debug build, which requires debug versions (you end up getting an error that msvcp120d.dll is not found instead of the standard msvcp120.dll that comes in vc_redist) of the redist dlls. The runtime library (under Project>Properties>Config. Properties>C/C++/Code Generation) needs to be changed from MultiThreadedDebugDLL to MultiThreadedDLL.
-In serial_flash_programmer, f021_SendMessage.cpp has #include "../include/fo21_DownloadKernel.h" instead of "/../include/f021_DownloadKernel.h".
Regarding the time issue to programming over this interface,
I'm able to look at a decode on a scope to see the characters. My Bluetooth UART is connecting directly to the f28035's SCI pins. On the other side of the bluetooth is a bluetooth dongle on a pc with a virtual serial port. I haven't been able to get it working above 38400 baud.
I have also noticed that if using internal oscillator of f28035, incrementing or decrementing OSCFINETRIM can tune the actual baud speed (as opposed to the programmed baud speed) which may improve connections at baud speeds that we would normally have trouble with. I may try to play with the oscillator trim until I get a trim that works for my connection and then hardcode it into the flash kernel.
Cheers,
Fulano
Hi Fulano,
Thanks a lot for the feedback. We have made adjustments for your second point regarding the VS project, and will release the "Release" version next time and also use statically linked libraries in the build so that users do not need VS to run the executable.
I will correct those other issues as well. Thank you.
Why are you adjusting the OSCFINETRIM? Are you doing this to adjust the clock of the C28x during boot ROM so that the SCI bootloader can use higher baudrates? I do not think this will increase performance much. It seems like most of the time is spent in the different layers of the communication stacks on the Host PC and BT dongle.
Even if you are doing this, you should still be able to have the Flash kernel perform an auto-baud lock with the host, without the need to hard-code the rate into the flash kernel.
Best Regards,
sal
Hi Sal,
I was thinking of adjusting OSCTRIM because sometimes depending on the oscillator (and temperature), the baud rate may be slightly off and this could be a way to tune it in case autobaud is not locking at higher speeds (like 115200). But, I think I may just leave it alone. Running at 38400 baud, it seems to be quicker now, just under 13 min to DFU over serial via BT. This is fine for our application and it works well. Thanks a lot for explaining the source of the delay (communication stack).
Hello Dan,
I am using Windows 10 and I see the same happen (I get a COM3 and a COM4) when I connect to a Bluetooth module. I tried COM3 and that didn't work, but when I tried COM4 it worked perfectly.
When I check bluetooth options under COM ports, I see the following.
If you are using the outgoing SPP Dev port, the serial_flash_programmer should work fine even though it says "outgoing". I was able to use it successfully.
I believe the outgoing/incoming simply indicates which device initiates the connection first. In your case it is the PC, so I would use the "outgoing" port your COM5.
I looked up the module you are using (sparkfun) and it seems some people have had issues because the TX and RX pins were reversed so make sure that is correct.
Hi Fulano,
Thanks very much for the help. I think that I have the BT module connected because it shows that "Kernel Loaded". However, it met a problem that after it shows "Application AutoBaud Successful", then serial programmer exits without printing any error and the program is not burned into the unit.
Have you ever met similar problem?
Regards,
Dan