Arduino Uno debugging - arduino

I'm absolutely new to microcontroller development and currently want to:
Understand a typical process of the development
Set I/O and tune all tools for the development.
Currently I'm using Arduino Uno (ATmega328 based)
I found PlatformIO. It looks useful for me to work with microcontrollers on different platforms
Qt Creator is a favorite IDE, and I'd prefer to continue using this for AVR programming (PlatformIO can also generate Qt Creator's project template)
I've tried to build and run first sketch there, it works. So the only question is still there is a debugging.
Correct me if I'm wrong, two primary ways to do this is a JTAG and debugWire, and both ones are "hardware" debug, correct? And, of course, require additional devices.
In other hand, Qt Creator has a "bare metal" plugin which can work (debug) with a devices who can "behaves" as gdbserver.
I also found this article where the author suggests own implementation for a library for an Arduino project, which emulates gdbserver for a PC GDB client via the usual serial connection. Of course, I'll try this way as a preferable in my case.
So the question is - please confirm that all assumptions are correct.
And probably someone uses this way (maybe without this IDE).

Related

Can QT and FreeRTOS work together on MCU?

I may ask a stupid question. I want to use FreeRTOS as the OS on my NXP MCU MIMXRT1062XXXXB. The MCU connects to a display. I want to use QT to development user interface application. I want to know if it is possible to run QT application base on FreeRTOS on MCU?
Yes it is possible - lots of people do it. My first Google search for this hit this page on the QT website: https://doc.qt.io/QtForMCUs-2.1/qtul-using-with-freertos.html

Can we use arduino libraries(e.g motor shield library) with the STM32?

I want to know if it is possible to use arduino libraries (e.g motor shield library) with the STM32 series? Has anybody tried it before?
Thank you.
Generally yes, but.
Arduino the software defines just an API. As long as your board has an implementation of that API, a library basing on it should work.
That being said, libraries that weren't tested specifically on STM32 might break for various reasons. If you use PlatformIO, you can look for libraries that use Arduino framework and support STM32 MCUs.
If you're using an Arduino IDE, it's also possible to program the STM controllers directly from it. You just need an appropriate core/board definition installed, and make sure that you pick an appropriate programming option (I personally use ST-link whenever I can instead of bootloaders+serial).

What is the difference between "ESP8266WiFi.h" and AT Commands?

I am confused that some people use ESP8266WiFi.h library and some people use AT commands for connecting a WiFi module to Arduino.
Do they work the same or not?
Is there is any problem with the library, or is the library for some different purpose and AT commands for other purpose?
That's a great question. It's definitely not obvious from much of the code and many of the questions people post.
When the ESP8266 first came out, it was only used to connect other processors to Wifi. It shipped running software that provided TCP/IP and Wifi support. You'd wire it up to an Arduino or other processor and control it with AT commands. But you would not change the software that ran on the ESP8266 itself.
Many people still use it this way, but it turns out that the ESP8266 is as capable as (or more capable than) some of the processors that used it to connected to Wifi. So developers put together toolchains for building software to run on the ESP8266 itself. They even ported the Arduino SDK so that you could run "Arduino" programs on it (even though it's not an Arduino).
ESP8266Wifi.h is a header file intended for software that's built to run on the ESP8266, as opposed to software built to run on an Arduino or other processor that uses the ESP8266 to connect to Wifi. When you build software to run directly on the ESP8266, it replaces the software that implements the AT commands - though you can reinstall that later if you want.
So when you see a project using ESP8266.h, it's meant to build for and run directly on the ESP8266. When you see a project using AT commands, it's meant to run on a second processor (most likely an Arduino) that uses the ESP8266 for communications.
There are also libraries like https://github.com/itead/ITEADLIB_Arduino_WeeESP8266 which help an Arduino talk to an ESP8266 - they hide the AT commands and provide a simple set of function calls to do what the AT commands do. This runs on the Arduino, the AT commands are still used but the programmer doesn't have to worry about them.
There are also other languages like LUA and Python that run on the ESP8266 itself. Again, these replace the AT software that it first came with.

What development options are there for proprietary BTLE profiles?

I'm working on a bluetooth le project that will bind to android and iOS. I looked at the TI CC2540 dev kit, but I am not sure what I need to do to prototype with it. Are there alternatives to the IAR compiler? If not, how easy/friendly is it to push firmware/profiles? Can I change the CC2540 module roles (have one as a peripheral and one as a broadcaster)?
Essentially, can I use the CC2540 dev kit (with IAR if need be) and program write a really simple application that with use the GATT protocol and stack?
The kit that you have quoted is simply a demo that helps you to evaluate the TI solution. The two devices are programmed with two different firmwares: the first one works as a Peripheral while the other one works as a Central.
TI provides you also a large number of demos with related source code, hence using IAR you can develop your application.

Interested in Device Programming. Where to Start

All
I've a Good Command over C++, But I've never done anything anything on device programming. I've some basic understanding on Digital Logic Design. But I am complete Noob in Electronics. Currently I am getting huge interest on microcontroller Programming.
Where To Start ?
I don't think one really needs to have huge amount of knowledge on electronics to run a program on a microcontroller.
I am using Linux. and I've downloaded Keil. never tried to run it through Wine. I've ran it in Windows. But how the code works is not completely clear to me. though I can understand Logic as its written in C. But Its still like a Fog to me.I Just need a Quick Kickstart.
SO is not the best site to ask this kind of question. There's really a large distinction between programming for a PC and programming for an embedded system, other SE sites specialize in physical computing. I got this email from Robert Cartaino on Tuesday:
...Barring any last-minute interest from
[chiphacker.com], we will be launching [electronics.stackexchange.com]
either tomorrow [Wednesday 9/22] or
Thursday.
So, go commit to electronics.stackexchange.com here, and browse chiphacker.com while you wait. Take a look at these questions on Chiphacker:
How to become an embedded software developer?
Steps to learning Arduino Programming
PIC Programming
What are the best beginner project[s] using an arduino
There are a few things you should consider when planning your entry path to embedded systems programming.
What do you want to do?
What do you know how to do?
How fast are you comfortable learning?
I've outlined a few options in the following paragraphs.
You tagged your question linux-device-driver, does this mean that you want to make a custom device to use in Linux? If you meant embedded-linux, then you're into a larger class of microcontrollers. I suggest that you look at the BeagleBoard, also look at this Chiphacker question for some other options. If you want to do embedded linux, and want to build your own board, you'll first need to build up some experience in simpler levels of embedded systems design.
You also tagged your question avr, which is a popular microcontroller class made by Atmel (check out the avrfreaks forum for more info). I started learning embedded systems on the ATmega324p; they really have great documentation, are easy to use, and there are more sites online for the avr than most any other processor.
If you want an easier learning curve, I suggest taking a look at the Arduino environment. It uses Wiring, which is very similar to C/C++, and the Arduino can be enhanced with 'shields', which are modules that can be plugged into the Arduino main board to add functionality. This is your Quick Kickstart.
A good learning path would be to get familiar with the Arduino, then build your own AVR board (possibly a Linux device, like a joystick), then work with an ARM-based development kit, and finally move on to to building your own embedded linux board. You can skip a few steps if you don't mind a steep learning curve, or stop at any point along the way if a given level's capabilities satisfy your needs. You don't necessarily need a "huge amount of knowledge on electronics to run a program on a microcontroller", it's true, but you should understand some basic things like voltage and current before you try to light an LED or connect two devices.
Finally, you said in your question that you've installed the Keil IDE. While this is a fine and rather popular IDE, I'd suggest that you learn using a gcc-based command line toolchain. There are a staggering number of ways in which things that can go wrong when working with embedded systems, and an IDE adds a layer of magic on top of everything that happens. While this can be nice, I'm a strong advocate of minimizing the magic when trying to learn the system. You need to understand the low-level stuff when things don't work automagically. This advice doesn't apply when using the Arduino, which is designed to (and does) make all of the automagical stuff work well.
sparkfun.com has a lot of boards, arduino family and other. I recommend the armmite pro, the lillypad instead of the arduino pro because there is no soldering involved, for either you will need/want the correct usb to serial/power. The mbed2 costs a little more, the blue leds are brutal on the eyes, but easy to use. For none of the above are you required to play in their sandbox, you can use the canned environment, etc but not required.
if it is linux development you are after I recommend the hawkboard.org over the beagleboard.org, to make the beagleboard useable costs about twice as much as the board itself, the hawkboard is usable by only buying something to power it. But you can just learn linux drivers on your desktop/laptop and dont need to mess with embedded necessarily.
Emulators are a good start. Qemu is good stuff, emulates a number of processors, great for emulating virtual linux systems, learning linux driver development, etc. But getting visibility into what the (virtual/emulated) processor is doing is not the goal. I find it useful to have visibility. gdb includes a few emulators as well. mame is loaded with them, but like qemu designed for fast emulation and not for education. visual boy advance is good. Emulation is never perfect, so eventually you want to run on hardware, but emulators and compiler tools are free and you can learn quite a bit before you have to buy hardware. There is a considerable amount you cannot learn from an emulator though, loading your programs into flash/ram, debugging using jtag or other interfaces. i2c, spi, etc.

Resources