SDHC and SDXC

SDXC

A couple of readers have warned me recently that SDHC and SDXC cards are becoming the norm and that spells troubles for the unaware.

In fact, both in the PIC24 (both editions) and the PIC32 book, I spent a couple of chapters to discuss the interface to SD/MMC Cards and developing a small library to allow access to files when the cards are formatted using a FAT16 file system.

While the key principles remain the same, things change quite a bit when you start consider (7 years later) what the market offers. Basically, SD/MMC cards are slowly disappearing as the memory size upper limit (2GB) of the original standard has been reached and quickly passed. To overcome that limitation, since 2009, several vendors have started adopting the SDHC specifications first (increasing that limit to 32GB) and the SDXC specification later (increasing the limit to 2TB).

At the same time the file system has changed as most users nowadays prefer FAT32 formatting and eventually the SDXC cards have been standardizing on the “exFAT” (patented) file system.

The SDMMC.c and FileIO.c examples do NOT support any such features!

Clearly it goes beyond the scope of the books I wrote, and it would require a much more complex body of code to keep up with these advances. Although I might soon add support for the FAT32 file system (or I might simply replace it in the examples), I think the most appropriate thing to do is to direct my readers to the Microchip MDD File System library.  This is a standard component of the larger Microchip Application Library and is a free, current, professionally maintained and documented piece of software that I greatly recommend for all actual embedded control applications!

Posted in PIC24, PIC32 | Tagged | Comments Off on SDHC and SDXC

CUI32 Stem

CUI32StemCUI stands for “Create USB Interface” and it is really an open project based on the PIC32 that includes a large set of modular hardware and software solutions, in their words:

The Create USB Interface is an open source microcontroller board that can be programmed in C, BASIC, or Arduino languages. This latest version is called the CUI32Stem, which is designed to work ‘hand-in-hand’ with the GROVE prototyping system including a wide range of sensors and actuators. It utilizes a high-performance Microchip® PIC32 microcontroller, allowing programmable interaction with all sorts of user inventions, no soldering required! “

I have recently taken a second look (here my first) at it and I was pleasantly surprised to see how polished and complete it got.

I like the USB bootloader, the Arduino compatible hardware, the StickOS simplicity and (why not) BASIC interpreter for some quick and dirty work.

Posted in PIC32, Tools | Comments Off on CUI32 Stem

32-bit PIC programming in Python!

PIC32MX4 Micromedia Python Demo

It has been a long journey for me to learn about modern interpreted object oriented programming languages, first on the desktop (see post here), later on industrial control and data acquisition applications (see post here) and now I feel like I have finally closed the circle: Python programming on an embedded control (32-bit) microcontroller thanks to the “Python-on-a-chip” project!

Dean Hall has been working at this project for several years now. He has demonstrated the possibility to run a small Python interpreter even on 8-bit architectures and others before me have ported the (well written) code to 16-bit microcontrollers like the PIC24. But since all Python interpreters have a huge thirst for RAM, it is only in the flat an (virtually) unlimited addressing space of a 32-bit microcontroller that Python starts really to make sense in my opinion.

So I have created a clone of the project (Mercurial) repository for the purpose (link)  and developed a new PIC32 port for the v10 revision of the project. While describing the whole project would take a while, it is interesting to note that the time I spent to “port” the PIC32 code in itself (from pull to first successful build) was less than an hour!

Actually most of the time for me went into figuring out how to use Python effectively to wrap existing libraries and get a useable,  or I should say a useful, package to develop applications on the PIC32 MX4 Micromedia Board.

At the moment I have demonstrated good real time support for the following features:

  • QVGA Graphics Primitives
  • Touch screen input
  • Joystick input
  • LED output
  • Serial input/output
  • Accelerometer input
  • Temperature sensor input
  • Audio (work in progress)

Eventually the project begs to be recompiled for a PIC32MX7 Micromedia board (128K of RAM!) where I could even dream to attempt a port of the PyGame libs to make development of little interactive applications real fast…

Please feel free to review the code and send your comments… but beware this is not a project for the faint of heart!

You will be required to master the following tools/application libraries:

  • MPLAB X
  • C32 Compiler
  • PIC32 peripheral libs
  • Microchip Application Libraries (GFX, MDD File System…)
  • Scons project manager
  • Mercurial versioning tools
  • Doxygen automated documentation generator/manager

Enjoy!

Posted in PIC32 | Tagged , , | Comments Off on 32-bit PIC programming in Python!

The Sinclair ZX Spectrum turns 30!

St. George

Happy Birthday ZX Spectrum!

Today Google UK  dedicates the daily doodle to  the 30th birthday of the ZX Spectrum.

I am part of that generation that learned to love computers/programming playing games like Manic Miner on an 8-bit little console with rubbery keys. The machine was so simple and ingenuous that you could get the entire schematic at a single glance and you could literally know every single line of code in the BASIC rom.

My tribute  to that lost (romantic?) era: an emulator for the PIC32 written entirely in C from scratch that runs the original games in almost real time (a bit faster actually) on a Mikroe Multimedia  Board.

Posted in PIC32 | Tagged , | Comments Off on The Sinclair ZX Spectrum turns 30!

Dmitry Grinberg

 

Single chip Audio Player

There are rare times when you realize unmistakably that you are in the presence of true genius. Visiting Dmitry’s web site today was one of them!

Check out this project and you will get the picture!

Now genius and madness are often separated by a thin line, here is a second example that will remove any last doubt!

I cannot wait to see what he will do next!

Posted in Tips and Tricks | Tagged | Comments Off on Dmitry Grinberg

Codecademy

Last night, I was cleaning up (managing) my notes (I use Evernote for pretty much everything in my life) and I stumbled upon a reference to “codecademy”.  For as much as I tried I could not remember what it was about or where I had gotten this, so I did what we all do nowadays, I googled it! The result a misterious link to a web site: http://www.codecademy.com

Codecademy

You must take a look! This is one of those things that make you say: ” Why did I not think of it?”

My head is spinning with ideas for courses, if only there was a nice way to apply it to Embedded Programming too…

Posted in Languages | Comments Off on Codecademy

MPLAB X

MPLAB X

So it is done! After more than two years from my first hopeful post I have completed the transition. I have severed all my connections with Windows. MPLAB  was the last strong chain keeping prisoner but with the latest release of MPLAB X (1.10 just a couple of days ago) I can finally say I am free.

No, it is not perfect yet, but I can definitely say that the advantages/features of the new (Netbeans based) IDE surpass the few remaining squawks and occasional annoyances/frustrations.

I love the new navigation capabilities, the call tree, the local history, the … it’s a long long list of sometimes little things that add up and can make your development time so much more productive.

It has been more than a year since I started using it (from the very early betas while re-writing many of the PIC24 book chapters for the second edition) and it is several weeks now that I am not firing up MPLAB 8 anymore. I guess this is the signal. Eventually MPLAB X has reached a level of familiarity for me such that I feel comfortable developing exclusively with it. Or perhaps there is a natural amount of time that our mind requires to accept a new tool, especially when it impacts so much our daily work.

MPLAB (8.x) is dead, long live MPLAB X!

Posted in PIC32 | Comments Off on MPLAB X

Virgil

 

Virgil

I was reading recently about the (slow) adoption of object oriented programming languages in the embedded world. There is quite a sad situation, while in the mainstream, OOP languages are pretty much a standard, in the embedded world, they are just starting to show up, why?

The problem is not the lack of say C++ compilers or Java environments for the architectures used in the embedded world, it is more a matter of dealing with the runtime overhead and code bloating often produced by those solutions. But independently from the language of your choice, not all OOP is bad (as in bloating and runtime heavy…) there are some constructs in each language that are worse than others.

Ben L. Titzer, Jens Palsberg and other researchers at UCLA have been working for years on the subject and they have distilled a list of good and “bad” features that impact so much more heavily the typical embedded application. Their recipe, a new language called “Virgil“, designed from the ground up to provide you with the best of OOP without the worst of OOP.

Virgil is compiled to native (like C++) but is also strongly typed (like Java) and shares a syntax that is certainly familiar to programmers of both origin. There are also provisions for low level management including interrupt handling, special function registers and bit manipulation!

The only problem is that new languages’ adoption is always very slow, even when there are strong sponsors… (anybody used “GO” recently?), so if we wanted to accelerate the adoption of OOP, introducing a new language is not exactly a quick option…

Nonetheless, take a look at Virgil and see if you like what it has to offer…

Posted in Languages | Tagged | Comments Off on Virgil

Maximite

I have to confess that, if I had not already done so in the past,  when I wrote some of the material for the PIC24″flying” book such as the composite video and the keyboard interface examples, I had a bigger project in mind. Eventually I was hoping to be able to put them together and (re-) create some sort of a mini personal computer. Unfortunately the early PIC24 models proved to have too little RAM for that purpose, but when the PIC32 came out, I gave the whole project a second try.

This time though I took a completely different route, using a USB keyboard interface (in place of the PS2) and using a TFT display in place of the PAL video output. FreeRTOS gave me the ability to put various other pieces together with some agility, including a Z80 interpreter/emulator and even a tape emulator (using SD Cards instead). The result has been the ZX Spectrum project running on the MikroElektronika MMB-MX4 boards. With it, you can run Sinclair Basic programs but also play old videogames in almost perfect real time.

Unfortunately, in the process the simplicity of the original idea got somewhat lost. The ZX Spectrum simulator is composed of several layers (FreeRTOS, USB, Graphics libs, Z80 emulator, SD Card file system) each eventually requiring of a certain level of knowledge to handle and maintain.

Maximite

Geoff Graham took a different approach and assembled instead a neat little board, the size of a credit card, to create a very agile little computer programmable in BASIC: the MAXIMITE. The project was the center of a series of articles he wrote for the magazine Silicon Chip where he described how he ended up writing almost from a scratch a BASIC interpreter for the PIC32. He has since posted the complete Maximite project on his web site and gathered a significant community around it.

I love his idea and I will keep checking his web site for news and future developments….

Posted in PIC32, Tools | Comments Off on Maximite

Atypical Curiosity

Actually I am typically pretty curious, especially when it comes to programming languages.

Atypical is a programming language that I discovered recently almost by mistake.

It was designed for the PIC and around the PIC assembly (midrange, 14-bit core) by Michael Park, with all the limitations and quirks of the PIC core, but with the intention to add a little structured programming and improve readability (quite a bit). Atypical flies very low, adding only a very thin layer of pre-processing to your source code. No fancy optimizations, if you are a hard core assembly wizard, you will appreciate how all the power is still in your hands…

As the author says, take a look and see if Atypical piques your interest! (link)

Posted in Languages | Comments Off on Atypical Curiosity