SAMD21G (Cortex -M0+) Programming/Debugging Connection - visual-studio

I bought a SAMD21G18A (ARM Cortex M0+) from RobotDYN and trying to simply get setup to program it but I can not find much documentation on how these are connected/setup for programming and debugging.
On the website it states "One of its most important features is Atmel’s Embedded Debugger (EDBG), which provides a full debug interface without the need for additional hardware..." so I assumed that the connections would be similar to some of the other MCU Development Boards like the Arduino, PI or Beaglebone meaning that there isn't any need for things like a JTAG Programmer but I don't know if that's the case or maybe I am just confused on how to set this up.
Can anyone point me in the right direction on how to upload the program and get my IDE setup? I can find all sorts of information on the Registers, the newlib library and stuff like that, but I can not find much on the actual connections or other needed components.
I would prefer Visual Studio +VisualGDB if anyone uses that combo but I will take any help so I can just get started. I also have tried Atmel Studio and the Arduino IDE also without success. Just to mention I am not looking for a step by step guide, just some direction and explanation of how I should proceed.
When I installed the Arduino IDE I was able to get the board to show up under COM11 as a Arduino-M0, so possibly I am simply missing some drivers?
Edit:
I have been searching the internet for possible ways of hooking this up and it seems like I need to have some sort of programmer/debugger. I also found there are a couple types of these boards out there, one of them is the XPlained series. I looked at the schematics and they have a ATMega in addition to the ATSAMD21. I have a variety of AVR's, BeagleBone Black and also a FTDI CDM USB cable. Does anyone know if its possible to use any of these to setup for programming/debugging?

Your SAMD21 board from RobotDYN doesn't have the Atmel EDBG interface, so you need an external SWD debugger like the Atmel-ICE you mentioned in your comment.
This debugger comes with the standard 10-pin Cortex Debug Connector, which is also present on the RobotDYN SAMD21 board (labeled "SWD(EDBG)", which is a bit unfortunate since it seems to suggest this is an EDBG interface, which it isn't). So the only connection needed is between these two connectors via the flat cable that is likely included in your Atmel-ICE kit. Pay attention to how you connect the cable to the RobotDYN SAMD21 board: the first pin of the 10-pin header (i.e. the one with a "1" label next to it on the PCB) must correspond to the first pin on the the Atmel-ICE connector, which is the pin at the bottom left. See also http://microchipdeveloper.com/atmelice:connecting-to-avr-and-sam-target-devices.

Related

Does the Sparkfun ESP32 Thing is compatible with generic modules like DHT11 sensor?

First of all I am kind of a noob working with microcontrollers, by the way I am using Arduino IDE 1.8.13
I fallowed the hookup guide to set up Arduino IDE to work with Sparkfun ESP 32 Thing board, and actually I was able to run the Arduino examples "Blink" and "Wifi" with no problem.
But my problem is when I tried to use the DHT11 sensor, I did fallowed several tutorials like this one but for my bad fortune I did not succeed, instead I was getting NaN reading from the temperature and humidity sensor, at first I thought it might had something to do with the libraries version, which I installed and uninstalled several times, including the IDE, then using those same libraries I was able to do the exact same example on an Arduino Uno microcontroller.
Then I realized I did not find any example, tutorial or document using the Sparkfun ESP32 Thing with the DHT11 sensor, since most of the examples that I found are for the generic ESP32.
Which makes me wonder, how can I know if those two components are compatible at all?
Does any one has faced something similar using ESP32 Thing with DHT11 or any another sensor?, if yes, how did you make it work or what did you do instead?

Writing linux kernel mode driver for custom touch screen

I'm having some difficulties writing a kernel mode driver on debian wheezy for a custom touch screen, that has driver only for windows. My main problem is, that I have absolutely no experience in driver programming, apart from the tutorial write-to-system-log module I've found on the internet. Also, I have some more specific problems as can be seen below.
Hardware structure:
The touch screen itself is connected to a microcontroller, that connects through serial port to the computer. I've managed to initialize the controller from user-space program connecting through ttyS0, and recieve raw data from the touch screen, but I just couldn't manage to get started from kernel space.
I've looked around in drivers/input/touchscreen/, opened a few .c files, so maybe I could find out, how to start at least, but I'm pretty stuck around here, because I can't substitute some values to match my hardware. In linux/serio.h there is a long list of defines for serio protocols, that for example elo touch screen's driver is using:
#define SERIO_ELO 0x29
Is there any kind of documentation about these values, their meanings, or how they are interpreted?
Are there any books or websites, from which I could learn more about this topic? For now, this is a really dark spot for me.
I don't intend to ask for a full solution, but I'd really appreciate some examples or tutorials regarding serial communicaton and/or touch event gerenation in kernel mode.
Thanks in advance for your help.

Good GUI library for program that connects to a microcontroller?

I'm trying to find a good GUI library I could use to create a program on the computer that connects to a microcontroller by USB. I've never done any GUI work before but I have done a lot of webpage design/tools. We are going to program the microcontroller with C but I don't think the GUI will need to be C. It needs to work on Windows, so probably compile on Windows too. I've also never done any USB transmission but I'm hoping to take it one step at a time.
Right now I'm looking at using GTK but it needs a bunch of other things to download with it. I'm also going to look at QT and someone else suggested making a Windows Forms Application. There's a lot of options out there so I'm having trouble figuring it out.
As for my requirement, it just needs to be a very simple GUI that has a few control buttons, a display area (info from microcontroller), a notification area (basically error messages go here), and maybe a graph. I've included a prototype GUI help give you an idea of what I'm doing.
Edit: It needs to run and compile on Windows. We don't really have a budget for it, free open source is preferred. I don't need something elaborate and fancy, I just want to get it done as fast as possible.
We are using a TTL-232R cable, UART interface. I know nothing about USB transmission, school has crushed me.
From what you've specified, I would set base-camp up at Java.
Java in Eclipse to write the code.
Java Swing libraries (helped by the WindowBuilder plugin for Eclipse) to "draw" the GUI. It is very easy to create "Windowsy" GUIs using these.
JFreeGraph libaries to allow you to create graphs very easily, again from within Eclipse.
RXTX library for "virtual COM port" serial communication within Java (it doesn't sound like you're using proper USB, but just RS232 with a USB adapter).
Your created GUI would run on any machine with Java installed, which is not a big ask for the end user. You can even create a Windows executable/installer from the resulting Java files if you wanted it to be a (apparently) native Windows application.
And - bonus - all the tools mentioned are free as a bird.
It will kind of depend on what kind of compiler, IDE, etc you will settle on. If you are going to windows cold, and
money is an issue, then open source is always a good thing to look at. I have enjoyed using eclipse and Code::Blocks IDEs. For C/C++, I use minGW. In terms of GUI plug-ins, HERE are some conversation with GUI recommendations specifically for use with Code::Blocks.
If money is not an issue, I have use National Instruments LabWindows/CVI full dev kit forever. It is one of the easiest ANSI C compilers/IDE I have ever used. It is only ANSI C, but has extensions to make using instrumentation easy. I have written a little USB stuff (not much), sockets, instrumentation, and many GUI apps.
Please comment what tools you currently prefer, I may have other suggestions.
Lazarus CodeTyphon has cross platform native compiler with GUI working on every supported platform. It supports 8 OS-CPU host layers (Win32, Win64, Linux32, Linux64, FreeBSD32, FreeBSD64, Solaris32 and Solaris64), and 25+ OS-CPU target layers. It also incorporates many graphical widgets and SCADA like behaviour with PascalSCADA and other components. There are wrappers for LibUSB.
I would use Microsoft Visual Studio to develop the GUI. They offer a free version called Express. I would use the C# language but MSVS supports other languages as well so just choose whichever you're most comfortable with. The best thing about MSVS is that there are millions of developers out there, which means that you will be able to search for and find lots of examples for how to use an RS-232 COM port or USB interface. I'm guessing that you'll be able to find GUI objects for graphing and other objects as well. (The basic stuff like buttons and edit boxes is all built into MSVS.)
BTW, you need to sort out whether you're using an RS-232 COM port or a USB interface. They're both serial interfaces but they're not the same thing. Either could work.

Testing PCI Interface on FPGA

My boss has given a code for testing PCI express on an Altera board. The code consist of several c code files having instructions such as reading Bios, setting some registers, writing to buffers etc.
My job at present is to see the functionality of the code by running it.
I am new to FPGA and I am unable to understand what tools, compilers etc will I use for compiling it for the FPGA.
Since it is a C code so I am sure I cannot use the same environment as that of Verilog/VHDL. Can I get some hints as to what compilers are available for compiling C code for testing various interfaces of an FPGA?
Thanks and regards
H
If the FPGA board is just connected through a standard PCIexpress interface, it isn't that hard to create a Linux driver to simply access a couple of registers. This might even be easier to do than getting some old DOS-based drivers to work.
I did some work on this in a pre-project to my masters thesis some years ago - if you're interested, it's available here: http://loejer.dk/files/FORK,%20pdf.zip
It sounds like the intent is that you connect the PCI-E card to a normal computer with a PCI-E slot, then run the test software on the host computer, so it will talk to the board via PCI-E, and exercise the board from the host, collect data on the host, and so on.
Such code will almost certainly be quite non-portable. You'll probably need to ask what system it's for (or examine the code to find hints -- e.g., if it starts with #include <windows.h> that's a pretty fair indication that it's for Windows).
The OS it's written for will give at least an 80% (or so) clue about what compiler to use -- if it's for Windows, chances are pretty good that it's intended for Microsoft's compiler. If it's for Linux, there's an even better chance that it's for gcc/g++. If it's for MacOS, it's probably for g++, but if it's really new, might target Clang.

Starting point for coding a virtual device

I want to write something like DaemonTools: a software that presents itself to the system as a real device (a DVD-ROM in the previous example) but it reads the data from a file instead. My requirement is not limited to DVD-ROM. The first goal is a joystick/gamepad for Windows.
I'm a web developer, so I don't know from where I could start such a project. I believe it will have to be written in C/C++, but other than that, I have no clue where to start.
Did anyone tried something like this and can give me some starting tips ?
Most drivers are written in either C or C++, so if you don't know those languages reasonably well, you'll want to get familiar with them before you start. Windows programming uses a lot of interesting shortcuts that might be confusing to a beginner - for example PVOIDs (typedef void* PVOID) and LPVOIDs (typedef void* far LPVOD;). You'll need to be happy with pointers as concepts as well as structures because you'll be using a lot of them. I'd suggest writing a really straightforward win32 app as an exercise in getting to grips with the Windows style of doing C/C++.
Your next port of call then is to navigate the Windows Driver Kit - specifically, you'll need it to build drivers for Windows. At this stage my ability to advise really depends on what you're doing and the hardware you have available etc, or whether or not you're really using hardware. You'll need to know how to drive your hardware and from there you'll need to choose an appropriate way of writing a driver - there are several different types of driver depending on what you need to achieve and it might be you can plug into one of these.
The windows driver kit contains quite a large number of samples, including a driver that implements a virtual toaster. These should provide you with starting points.
I strongly suggest you do the testing of this in a virtual machine. If your driver successfully builds, but causes a runtime error, the result could well crash windows entirely if you're in kernel-mode. You will therefore save yourself some pain by being able to revert the virtual machine if you damage it, as well as not having to wait on your system restarting. It'll also make debugging easier as virtual serial cables can be used.
This is quite a big undertaking, so before you start, I'd research Windows development more thoroughly - check you can't do it using the Windows APIs first, then have a look at the user-mode driver framework, then finally and only if you need to, look at the kernel level stuff.

Resources