The Celtic Engineer is a weekly newsletter produced by Celtic Engineering Solutions. We hope you enjoy it. If you have any suggestions for topics, would like to give feedback or want your email added to the distribution list please send an email to TCE@celticengineeringsolutions.com.
What’s an IDE?
If you are a firmware developer, you use every advantage you can, every tool that makes you job easier, faster and more efficient. But if you are a hobbyist, or one of two or three EE’s in your company, jumping into firmware may be a daunting task.
I wanted to continue along the theme of the basics of what you need when you are developing a prototype. An IDE or Integrated Design Environment is the interface that allows you to connect with and program your microcontroller. It usually works in collaboration with a programming module that connects to a JTAG, or other interface, connector on one side and a USB port on the other.
On a sophisticated IDE, you will be able to see all the registers and set up breakpoints. You can do all the things you need to do to develop some very sophisticated firmware. The IDE may not be free, or cheap. The programming module can range from a hundred dollars to a few thousand dollars. And the knowledge about how to use said equipment is usually measured in blood and tears. Such is the realm of the professional firmware developer. As they say, “That is why they get paid the big bucks.” They deserve it because they have earned it.
So, you are not the apex predator when it comes to firmware developing, and yet, there you are in front of a future prototype trying to decide how you will figure out if it will do what you want it to do or just exactly what you told it to do? I was once told the hardest part of using a new microcontroller is to get a UART port working, the rest is cake. By setting up a UART port on your MCU, you can send yourself whatever message you want to from whatever point in the code you need to. That means you can essentially set a breakpoint by putting a print message to yourself. You can say things like “D,” “42,” “I made it to the place I wanted to get,” “I got to the place I hoped I would never get,” or “The value in the register is 253!”
The miracle of the virtual COMM port
There are a host of chips out there that will convert from UART to USB. Then all you need is the correct driver on your PC and a terminal emulation program like Tera Term and you can talk directly to the MCU. The signal is sent from your prototype using modern USB electrical protocol, but all of that is invisible to you. All you know is that you sent a serial port signal out of your MCU and you looked at a COMM port with Tera Term and there was the data. This is a no fuss way of communicating.
The Speed limit is 55MPH
There are certain limitations with this approach. If you are planning on processing photographs or movies and sending them streaming to your PC over a virtual comm port, plan on getting your patient pants on. You can easily transfer at 115K which is blazing if you are sending small, or even modest, amounts of data. It will make you feel like you are receiving the first pictures from Mars in the 1960’s if you are transferring pictures or other large data sets.
What is the drill?
In order for this to work, you will set up a UART port on the MCU and then set up your print statements. I drop a line of code that says send ascii character “A” to UART0 and then go look at Tera Term to see if it made it to my PC. That is how simple it is. The other way is just a simple. Send an ascii character to MCU and an if statement in your code that says turn on an LED or do some process if you receive some character. I usually reserve the letter H or h, yes they are different, for help so I can tell myself, or someone else, which characters they can send to get work done.
This simple way of debugging code can be used with an Arduino (Atmel) processor or an ARM processor. Although if you are timid about writing code and have jumped into an ARM processor, well, good luck.
Why isn’t this done by professionals
You might ask why a nonprofessional is writing firmware. The reality is resources are always scarce. You might be a mechanical or electrical engineer or even have a degree in physics and have been hired to do a job you feel completely comfortable with. But then along comes this need that the company doesn’t have the right person for and someone says, “Who wants to tackle this?” Then off you go down a new road. Those kinds of things can be really exciting. Having the right tools, appropriate expectations, and if you are really lucky a mentor to help you along the way can make all the difference between falling on your face and a successful first foray into a new field.
Good luck and good coding!
This newsletter is sponsored by Celtic Engineering Solutions LLC, a design engineering firm based out of West Jordan and Murray, Utah, which can be found on the web at: www.celticengineeringsolutions.com. We are also on Facebook, Instagram and Twitter. If we can ever help you with your engineering needs please contact us. You can find the newsletter on the company blog, LinkedIn or in your inbox by subscribing. Send your emails to The Celtic Engineer at: TCE@celticengineeringsolutions.com, with the subject line SUBSCRIBE.
Do you know someone who would enjoy the newsletter? Forward them a copy or let them know where to find it.