Spanish Italian
17447 Users    

Part 1- An MCU-resident rapid prototyping and education environment for highly integrated MCUs

  Download PDF version of the Article

My name is Rich and I’m a Freescale developer in my spare time. If you’re anything like me, you probably got really excited the first time you heard about a computer on a chip. I mean what a great idea, an entire computer all on one chip. Right. And maybe you got on the phone back then and you know ordered it from Keynes Electronics or digikey or somebody like that, showed up in the mail a few days later, I mean this is great. You know you’re super excited. You know what this thing looks like even before you get the box open, right. I mean it’s got 40 pins. It’s got dual package, classy EPROM window. I mean once you got it open, you were a little bit surprised. I mean where’s that Db 25 connector I was expecting to be on the back of this thing. I mean this is a computer on a chip. Right. I got to be able to log in. I got to be able to program it. I got to be able to do all sorts of things right. It’s interactive, right. It’s a computer. Anyway, you got into a little bit more and you learn that, it wasn’t really that kind of a computer on a chip. This is more of programmable chip than a computer on a chip. Yeah software development environment over here, running on your real computer. You can write the program and compile a program you know and then you could download it to the programmable chip. You could maybe see what works what doesn’t work and then you could go change the program over here and you know try to get in things like that. Eventually, you get your program to run. But when you were done, you really just had kind of a smart programmable chip. It wasn’t really a computer on a chip. It wasn’t quite what you were expecting. Another problem with this too. I mean you bought this computer on a chip because it has all these fancy peripherals right. It had analog to digital converters, pulse width modulators. It had you know timers, flash memory, EPROM back then or something like that right. Also it’s a great peripheral that you want to take advantage of and you want to connect to your embedded system.

Anyway, when you get over here to your software development environment then you get this 500 page reference manual that basically tells you know how talk dio registers you know really innovate details that maybe you weren’t quite that happy to learn about, right. Basically, you found that in order to write a byte of flash memory, you don’t have to go through all these algorithms. You had to read all sorts of things and you know it was a lot of work and all you wanted to do is use a flash memory. All you wanted to do was take these really cool peripherals and you want to just kind of connect them together at a high level. You want to take some from the analog to digital converter, and you know so something with an I/O pin and things like that. But you didn’t want to have to learn how to talk to a program in analog to digital converter. You just wanted to use it.

Anyway, one of my goals in life is to bring embedded systems development to the masses. I think there are a lot of people out there who aren’t using embedded systems. Its really hot, cool microcontrollers who could be using it, right. These are people in education or researchers doing low volume work. You know they want to connect up stuff in their lab or whatever. I want to scatter these things all throughout my house, throughout my yard, throughout everywhere, and make them all talk to each other and do cool things for me, right. But I don’t necessarily, well actually I do. But not everybody necessarily wants to get intimate with their MCU in order to do that. They would like to just be able to pick out an MCU that has all the features they want, connect up the things together at a high level and then be done with it and have a really great cool thing that they can show people or things that will do useful work in their lab or wherever. Anyway, let’s see how the badge board might be able to help us do that.

Okay. So here is my badge board. We’re going to lay a little game. Not a very exciting game, its pong or paddle ball or whatever you want to call it. It’s a little different. It uses an accelerometer to move the pedal and make sound effects. Let’s see how I do under pressure. You can see we move the pedal. Anyway, there we go. I bounced it once and I bounced it again. I bounced it again. Oh this is a lot better than I usually do. Anyway there we go. I lost. Anyway what’s exciting here isn’t that I can play pong or paddle ball on the badge board. Okay. What’s exciting is how I got here. Okay what I didn’t do is start with my development environment over here and my 5000 page reference manual read a big, you know read up on analog to digital converters and timers and things like that and you know write a program and then download it to the badge board and have it not work and then go over here, edit it and download it again and eventually get it to work. I didn’t do that. What I did for this program is I started with a dumb terminal. The terminal I know you’re running on my PC and I hooked it up to the USB point on the badge board and I talked right to the computer on the chip. The computer on the chip is running an entire operating system. He exposes a virtual com port out of the USB and he’s got you know an editor, a transparent line by line compiler. As you enter your program, it’s automatically compiled. An interactive debugger, a flash file system where you can store multiple programs, all running right here on a computer on a chip. Okay. This is what I dreamed of. This is the DB 25 connector sitting on the back of the chip and if this chip has USB like a 51JM128 or 5521, you can connect the USB. If it has Ethernet, buy the 52233, you an connect the Ethernet, if it has a Zigbee wireless, transceivers sitting right next to it like a132OX, you can connect to it via a Zigbee wire. You don’t need any wires. No USB or Ethernet and you can log in, wrote your program, edit your program, debug your program, get your program running and then you can even make it auto run when you turn power switch on. We’re running basic program here to play pong or paddle ball whatever. It is 93 lines of code and that includes comments. Okay, probably more comments than I should have out it in. anyway, so 93 lines of basic and we are playing pong okay. In basic, the operating system understands all the peripherals built in the chip. He understands analog to digital converters, he understands pulse width modulation. He understands digital I/O things everything. So one line of code in basic to read the analog to digital converter. Basically you can bind a variable like tilt, it’s a variable that I use to analog to digital converter on a pin and then from then on, when you read that variable, instantaneously in real time you have got the number of millivolts on that pin. You can just refer to it in basic program. Likewise, when we are generating audio signals, when we are generating audios signals, I can just bind another variable, maybe one called audio to a frequency output pin that’s connected to this buzzer. I can say let audio equal a 1000 and boom and I have got a 1000 hertz signal here using a pulse width timer module. Basically, in basic everything becomes easy. You don’t have to read the 500 page reference manual. You don’t have to you know understand I/O registers or anything like that. You can do timers, you can do interrupts, you can do all sort of things. You can have watch points, break points all sort of things in basic one line per operation as opposed to a 500 page reference manual. Then in basic, basically you can connect together all these fancy peripherals that you got, that you wanted, with high level statements. You can take in analog, input from one and you can do something on a digital ap as a result. Basically, you tie together al, your complicated peripherals using simple statements in basic and the operating system knows hot to mange them. And the operating system knows how to manage them for the different chips and it’s the same regardless of which chip you’re on. Anyway we will be right back.

One more thing before we get into the actual demo. We are going to go into the code. There another thing that’s missing here. Okay. Remember how I talked about the Zigbee wireless. Freescale has this card, the 1320XRFC that’s really, really cool and it will plug into the badge board you got to solder a connector on it. And actually there’s a real fly in the ointment here. You got to lift one pin of the MPR084 off its pad because the IRQ point isn’t open like it should be. So basically, in order for this guy to be able to drive the IRQ pin, you need to basically remove his IRQ pin, otherwise they kind of fight when this guy is not exerting and interrupt, and this guy wants to exert and interrupt, he doesn’t win most of the time. Anyway, so other than that we will stick with, you can now plug the wireless card into the badge board and now the badge board has wireless. Basic programs, not only can you more control them you now log in, break a program and debug your program over wireless. Basic programs can talk to each other over wireless. So for example, a basic program running on this badge board can actually talk to a basic program running on another badge board and you can modify variables on the other board and of those variables happen to be bound to pins like for example, the buzzer, he can make the buzzer run over there. Or you could have this guy hooked up to light switch and the other guy hooked up to a light and you can make the light switch work and a real simple example where we can actually use the accelerometer on this badge board to control the intensity of an LED on a different badge board. Using analog input on this one and analog on the other one Zigbee to time together. Anyway in ten line of basic program in total between all of them. Anyway let’s go take look at the anatomy of the basic program. We will be right back.

Okay so here is a badge board. I turn it on and you will see we’re running our basic program and I’m going to hook it up to the terminal emulator and the program is going to keep running. And what we’re going to so is we’re going to break in by pressing control C and we’re going to stop[ the program and basically, we’re going to enter an interactive debugging session. And so, I stopped the program, I pressed control C. it says stop at line D50. We stopped in the middle of an audio sequence and so one of the output pins of the MCU was generating whatever that was 500 or whatever it was and so we have a variable a basic pin variable, but its bound to the output pin. So what I did, I just set it to zero to turn off the tone so we could talk.

Dev.Emcelettronica CPUStick - BUY IT NOW! (24/48h delivery)

Read also: CPUStick

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
8 + 6 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Who's new

  • JM
  • samsilva77
  • araghube
  • stoll
  • mt
  • orionkw
  • pulper
  • mauriss
  • jbares
  • christiank79

Who's online

There are currently 0 users and 47 guests online.