Open lorforlinux opened 3 years ago
Hi @lorforlinux, it is my intention to have a low cost, generic USB to UART bridge program the MSP430 with webprog. I have not yet tried it with any of the chips you have mentioned (I'd like to). Instead I was testing it with an MSP-FET.
One issue with using a generic USB to UART bridge is that the MSP-430 first needs to be put into bootloader mode. If the MSP430 is unprogrammed, then it will enter this mode automatically, so no problem. If not, this can done by sending a simple pattern of high and low pulses on the TEST / nRST pins. I think some USB to UART chips have 2x programmable GPIO pins - but I don't think these can be controlled using the Web Serial API, so this approach will not work for webprog. Another solution is to have the existing MSP430 firmware jump to the bootloader in response to a UART command.
That sounds awesome Malcolm, I believe we are working for a similar cause here. I have created a low-cost dev-board for MSP430 called MSP430_Breadstick and I am using a modified BSL-Demo executable (only on Windows) for programming it. I have documented the process in this YouTube Video. I think BSL-Scripter can also be used to program the MSP430 through BSL but, I haven't tried it yet (Work in progress). I am also creating some other variants of the MSP430_Breadstick with CP2104 & CH340C to make it even cheaper and hopefully a good alternative for the Arduino boards of a similar price range (~$5).
I agree we have a shared goal of making it easy to program an MSP430 via the BSL. I like your MSP430_Breadstick design on GitHub. I have also got a development kit in the works (described here) and it is my intention to release it soon under the CERN-OHL-v2-S. Unfortunately version 1 of my development board will not have a CH340 / CP2104 or similar. I ran out of time for this feature, so it requires an external USB-UART or SBW. On-board programming is an aim for version 2.
Having watched your YouTube video I have seen you are using RTS and DTR to invoke the bootloader. I had heard of this being done, but not seen it before today, so thanks. I have just seen that these 2 signals can be controlled by the Web Serial API ([link to spec] (https://wicg.github.io/serial/#setsignals-method)). Therefore with a call to setSignals() in javascript, webprog.js. should be able to make the correct pattern on RTS and DTR to invoke the MSP430 bootloader.
I tried to use BSL-Scripter a while ago and found it to be a bit awkward. I cannot remember exactly why, but it gave me some problems. According to this post https://www.eevblog.com/forum/microcontrollers/need-ideas-for-msp430cp2102-bsl-circuit-running-bsl-scripter/ it doesn't invoke the bootloader like BSL-DEMO does, but maybe TI have updated it since then?
it is my intention to release it soon under the CERN-OHL-v2-S
Your development kit design looks cool when are you planning to launch it?
webprog.js. should be able to make the correct pattern on RTS and DTR to invoke the MSP430 bootloader.
I would love to know your code better to get an idea of how it's working so that I can chip in and help you with development and testing if you are cool with it. I was thinking of creating a python script and integrate it with Energia so that people can code and upload at the same place but, having an idea of how the process works with javascript first will definitely prove to be very useful.
it doesn't invoke the bootloader like BSL-DEMO does, but maybe TI have updated it since then?
They most probably did change things as there is no sign of USB-UART in any of their docs and I don't think they want to hide this valuable information. The BSL-Demo has no Linux alternative and things work way smoother in Linux for me thus this hassle to create a tool.
There is one more project I want you to see, the msp430-bsl-programmer from FlyingCampDesign. This one uses the FT232R chip's capability to invert and swap the RS232 signal line to program the MSP430 using a custom script incorporating the python-msp430-tools project (Python2 only).
What I need to do is write some documentation, first of all adding to README.md and then I will add some inline comments with the JavaScript.
A good place to start in the JavaScript is the async function program() on line 547 of webprog.js
The serial port is opened using the web serial API, then the TI-TXT file is parsed, first into blocks (one for each memory location to write) and then into BSL commands (I think there is a maximum of 256 bytes that can be written in one BSL command). I think I also do a CRC check at the end and make sure that each BSL command has been acknowledged. Will get something written up in a few days.
Another feature of webprog.js is it can load a ti-txt file from a URL, so a user doesn't have to copy paste the file contents into the top text box.
The bottom textbox below the program button gives a read out of each BSL command sent and the MSP430 response.
Thanks, I really want to get my development board on sale in a month. I'm putting a fair bit of my spare time into it these days.
I haven't been able to answer all points from your previous message - will do so later.
Thanks for the valuable information, the more I know about the project the more I want to work on it. Until you start working on the documentation I will try to understand your code as much as I can and learn things in the process.
All the very best for the release of your board, looking forward to seeing one in action somewhere.
Hi @malcolmmackay, your project seems very interesting to me and I wanted to ask if we can use any generic USB to UART bridge (FT232R/CH340/CP2104/PL2303) for programming the MSP430 with your programmer.