Didn't look deeply into SPI, but, considering they're both supported by the AVR feature set (look at the datasheet on Atmel.com), it ought to be simple. The thing about Arduino is that there are only so many pins available for expansion - so you have to give something up. My question is - WTH do you have to give up analog pins - why not digital? Anyhow, here's a guy who's been through it :
http://www.neufeld.newton.ks.us/electronics/?p=241
Sunday, September 13, 2009
Wednesday, September 9, 2009
Mission Impossible
Alright, I've had it. I need this gadget now. This is no simple MCU hack of course but..
See what you buy and where you prefer to buy it. Have a bar code reader on your fridge and check items in. Have one on your pantry door as well. Get an idea of the frequency at which you buy the stuff (so you don't have to install weight sensors:) On the other hand, you could check stuff out of the fridge as well - to keep track of usage. Anyway, bottom line is, your fridge will inform your gadget that you need item x.
Then, in the course of your weekly movement, you gadget will alert you when you're close to your chosen store. Sometimes, taking the right exit makes all the difference in gaining that extra half hour of life to do with as you please.
This is going to take GPS and a small form factor PC. But it will be done!
See what you buy and where you prefer to buy it. Have a bar code reader on your fridge and check items in. Have one on your pantry door as well. Get an idea of the frequency at which you buy the stuff (so you don't have to install weight sensors:) On the other hand, you could check stuff out of the fridge as well - to keep track of usage. Anyway, bottom line is, your fridge will inform your gadget that you need item x.
Then, in the course of your weekly movement, you gadget will alert you when you're close to your chosen store. Sometimes, taking the right exit makes all the difference in gaining that extra half hour of life to do with as you please.
This is going to take GPS and a small form factor PC. But it will be done!
Monday, August 31, 2009
Glitches Explained
Turned out it was the "noise" (in this case, deterministic unwanted patterns on some key voltages) in the noisy testmode in which there was a lot of switching going on. Thing of my chip as a spider on a thin web - the thin web is the supply and ground connections. Now, the spider has a fan that's out of control - and that keeps bouncing it all around by blowing air around uncontrollably. The solution, in this case, increase the moment of inertia of the spider by increasing it's mass - here, add bypass caps between supply and ground. Electrically, what you're doing to help out the spider is putting a sink that'll make the air the fan is blowing recirculate back to itself - so there can't be any uncontrollable bouncing. Clear analogy ja?:)
Interestingly enough - on the node where the noisy switching signal was being muxed out - if I connected a long cable, I could make things more noisy - and get the glitches back. The extra current pulled from the supply in transient to work the capacitance of this cable was enough.
Interestingly enough - on the node where the noisy switching signal was being muxed out - if I connected a long cable, I could make things more noisy - and get the glitches back. The extra current pulled from the supply in transient to work the capacitance of this cable was enough.
Saturday, August 29, 2009
Glitches Galore
Damn! The thrill of getting something done evaporates when you see that it works most of the time, but there are cases when it doesn't. Tricky glitches screw you up one in 5 times and that's enough to make it look like crap. When it's all digital (or supposed to be) you expect stuff to work 100% of the time. Take this example. My chip takes a pulse to increment the register pointer. We use a board with push-buttons to generate these pulses. To go from state 0 to state 15, you hit the button 15 times. With software, it's trivial to write a function that takes an argument and goes to a specified state in a jiffy. Problem is, there are times it's off by 1 state - it sometimes rolls over into state 16. You get a feel for the mountain of work involved in testing something before you can sell it. Nothing like having many hands here to make work light. Eyeballs too of course - it's the information age.
In this case, it's looking like the assumption of 100% digital is incorrect. One of the states sends a rather noisy signal to one of the pins and that might mess up my setup that has lots of parasitic inductance in the leads - rather than transmission lines to convey the signals cleanly. Probably a signal integrity thing here. Never had to deal with that before.
In this case, it's looking like the assumption of 100% digital is incorrect. One of the states sends a rather noisy signal to one of the pins and that might mess up my setup that has lots of parasitic inductance in the leads - rather than transmission lines to convey the signals cleanly. Probably a signal integrity thing here. Never had to deal with that before.
Thursday, August 27, 2009
Maker Makes It
An end to end solution. That was fun - developing the software and hardware and delivering a complete solution - giving a demo. All in a day's work. Here you see the Arduino mating with a custom board delivered by ExpressPCB.com and assembled by me with parts from Digi-Key. Systems, here we come!
Of course, this is not the end. It's something I can use, but not something everyone can depend on, without doling out more TLC than they care to. Packaging is required - we need headers on the custom board to mate it with the Duemilanove with minimal effort. Plug and play is the name of the game. Anyone know how to launch a program on Win or Unix automatically when you plug something into USB? How does the PC know what you plugged in and what to launch? Good q.
Of course, this is not the end. It's something I can use, but not something everyone can depend on, without doling out more TLC than they care to. Packaging is required - we need headers on the custom board to mate it with the Duemilanove with minimal effort. Plug and play is the name of the game. Anyone know how to launch a program on Win or Unix automatically when you plug something into USB? How does the PC know what you plugged in and what to launch? Good q.
Tuesday, August 25, 2009
Sub-Microsecond Delays with Arduino
It's possible!
The Arduino delayMicroseconds() function creates the shortest delay possible from within the Arduino language. The shortest delay possible is about 2 us (microseconds). Not true - I've tried and the shortest is about 4.5 us.
For shorter delays use assembly language call 'nop' (no operation). Each 'nop' statement executes in one machine cycle (at 16 MHz) yielding a 62.5 ns (nanosecond) delay.
__asm__("nop\n\t");
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t"); \\ gang them up like this
Really, why not a loop?
Dat's vy :
Verdict :
You also need to know stuff on this page :
http://arduino.cc/en/Reference/PortManipulation
If you use digitalWrite(), a single write takes 4.5 us to execute. But using
PORTB = PORTB & B11101111;
to set pin 12 low, with no intentional delay, I see a delay of about 400 ns. So much for being able to get 62.5 ns! If I put in 4 NOPs, I get the delay increasing to 620 ns. So we're on!
The Arduino delayMicroseconds() function creates the shortest delay possible from within the Arduino language. The shortest delay possible is about 2 us (microseconds). Not true - I've tried and the shortest is about 4.5 us.
For shorter delays use assembly language call 'nop' (no operation). Each 'nop' statement executes in one machine cycle (at 16 MHz) yielding a 62.5 ns (nanosecond) delay.
__asm__("nop\n\t");
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t"); \\ gang them up like this
Really, why not a loop?
Dat's vy :
If you write a C loop, it will change into NOP instructions and compares/increments for counters. So your timing will be off. Unrolling loops is a standard practice to get rid of the compares/increments.
Verdict :
You also need to know stuff on this page :
http://arduino.cc/en/Reference/PortManipulation
If you use digitalWrite(), a single write takes 4.5 us to execute. But using
PORTB = PORTB & B11101111;
to set pin 12 low, with no intentional delay, I see a delay of about 400 ns. So much for being able to get 62.5 ns! If I put in 4 NOPs, I get the delay increasing to 620 ns. So we're on!
Labels:
arduino,
atmega,
atmel,
duemilanove,
instruction,
microcontroller,
precise delay,
timer,
uno
Space Left on Your Board - What to Tack On
Put some 0603 or 0805 land connected to some large pads that you can solder wires to. Same with some SOT23's since you can connect decent robust transistors to those. Then, you're all set to blue wire your board and cover up your mistakes.
National Trips Up TI
LM2611 needs a min of 2.7V, didn't want that to limit the min VDD at which I could talk to my part, so I run if off my 6.6V rail that the TPS61085 is putting out. Not sure where my big mistake is, but the joy of getting the 61085 working after realizing that NXP puts stripes on the CATHODE of its Schottky diodes unlike the rest of the world soon evaporated when I saw what the LM2611 was doing to the boost output. That's a big lesson - you need to think about high current issues - a charge pump is probably way better off here in terms of working right off - especially when you've got a fixed voltage rail. What was I thinking? I thought - hey, a Qpump needs a regulated input, I'm better off with a switcher. What I didn't tell National in their feedback form was that the Cuk is pulling about 1A out of the boost. The table is getting hot!
I am using the LM2611A driven by an on-board boost (TPS61085) to realize a -5V voltage. I am using components according to the datasheet Figure 1. The boost output is correct when the LM2611 is disabled - it is 6.6V solid. However, when the LM2611 is enabled, there is large ripple on the boost output and the feedback node voltage of the LM is about 0.4V and the output is about 2V. The boost output average value is still 6.6V when the boost is overcompensated - with a 0 ohm and 1 uF cap on COMP. With 51k and 1 nF, the ripple is about 10V p2p. There is no other load on either the boost of the Cuk. Any help I can get in resolving this issue will be greatly appreciated.
Looking at the LM2611 datasheet - it looks like the startup current (despite what is claimed as soft-start) is way up there in the 1.5A range. So it could be that the 61085 is cycling in and out of UVLO all the time. So nothing really works. I wonder if a charge pump would really be better of here - if you can find a low current part, go with it.
Their response :
__________________
The issue is you have a boost regulator (TPS61085) is driving a dynamic load (the LM2611). So first you should probably put a filter between them - for example a cap to further reduce any existing ripple from the boost regulator. The other thing to check is the inductor you've selected for the boost regulator. Depending on the current load of the LM2611, it will also determine the value of inductor of the TPS61085. Also, you probably should first check the LM2611A circuit by itself, with a test bench power supply, and then you can see thecurrent levels you can expect (both average current and the transients). From then you can optimize the boost regulator circuit inductor and other parts (output cap, etc) appropriately.
_____________________
What they missed (failing to see things from the customer's point of view can sometimes be fatal. But, a big outfit like NSM is probably safe) :
1) I've done my layout already. If they know something like this probably won't work, why not specify the source better on their datasheet?
2) Who really has the luxury of trying out different caps and inductors? That's nuts - this is not like running spice on your ckt.
My mistake was in not using jumpers to isolate the different modules and allowing test-sources (clean, expensive) for verifying the modules. What I did try was to force the 6.6V output of the TI boost and see if that helped - but I was forcing through a really long cable, so it probably had almost no effect.
Any, end of the story is that most of the bench triple supplies have a negative supply that you mostly can't use for anything else, so all I had to do - and here, my great idea of putting down some non-standard pads at the last minute really helped me out - I was able to put down a 2N7002, a resistor and some wires do give the MCU more control. Stuff works pretty well actually.
I am using the LM2611A driven by an on-board boost (TPS61085) to realize a -5V voltage. I am using components according to the datasheet Figure 1. The boost output is correct when the LM2611 is disabled - it is 6.6V solid. However, when the LM2611 is enabled, there is large ripple on the boost output and the feedback node voltage of the LM is about 0.4V and the output is about 2V. The boost output average value is still 6.6V when the boost is overcompensated - with a 0 ohm and 1 uF cap on COMP. With 51k and 1 nF, the ripple is about 10V p2p. There is no other load on either the boost of the Cuk. Any help I can get in resolving this issue will be greatly appreciated.
Looking at the LM2611 datasheet - it looks like the startup current (despite what is claimed as soft-start) is way up there in the 1.5A range. So it could be that the 61085 is cycling in and out of UVLO all the time. So nothing really works. I wonder if a charge pump would really be better of here - if you can find a low current part, go with it.
Their response :
__________________
The issue is you have a boost regulator (TPS61085) is driving a dynamic load (the LM2611). So first you should probably put a filter between them - for example a cap to further reduce any existing ripple from the boost regulator. The other thing to check is the inductor you've selected for the boost regulator. Depending on the current load of the LM2611, it will also determine the value of inductor of the TPS61085. Also, you probably should first check the LM2611A circuit by itself, with a test bench power supply, and then you can see thecurrent levels you can expect (both average current and the transients). From then you can optimize the boost regulator circuit inductor and other parts (output cap, etc) appropriately.
_____________________
What they missed (failing to see things from the customer's point of view can sometimes be fatal. But, a big outfit like NSM is probably safe) :
1) I've done my layout already. If they know something like this probably won't work, why not specify the source better on their datasheet?
2) Who really has the luxury of trying out different caps and inductors? That's nuts - this is not like running spice on your ckt.
My mistake was in not using jumpers to isolate the different modules and allowing test-sources (clean, expensive) for verifying the modules. What I did try was to force the 6.6V output of the TI boost and see if that helped - but I was forcing through a really long cable, so it probably had almost no effect.
Any, end of the story is that most of the bench triple supplies have a negative supply that you mostly can't use for anything else, so all I had to do - and here, my great idea of putting down some non-standard pads at the last minute really helped me out - I was able to put down a 2N7002, a resistor and some wires do give the MCU more control. Stuff works pretty well actually.
Monday, August 24, 2009
Maker Breaks It
Not only did my on-board boost not work (TPS61085), but the current it pulled from the supply was so weird in transient that it was the least I could do to 1) Turn off power, 2) Take that chip out. I saw straightaway some mistakes I had made in my design and approach :
1) I had left the FREQ pin floating. Wonder how you catch stuff like that without an LVS?
2) I didn't put in a jumper on the supply to the boost - I should have made it easy to cut this thing out - as it turned out I had to use the heat stream to get the chip off and there were still problems after that.
3) Shame on me - knowing about the backgate diode and having PMOS pullups, I didn't put in a jumper to cut the PMOS pullup out - now that backgate diode is clamping on of my comm pins - but, somehow, though the scope doesn't pick it up, the interface still works.
4) I should have put a jumper cutting the inverting boost off from the output of the boost. Childishly simple, but it's amazing what you can not-think of when you're under pressure. Lesson - think modular.
5) I should have put more pads on the board to let me solder some wires to drive these functions from the outside in the event they didn't work. Lesson - think modular and what-if!
6) In soldering (assembly), I should have thought modular too - start off with the boost and see if it's working.
Weird, with an input supply of 3.5, and the chip removed, and supply passing through the boost inductor (3 uH) and then going into the Schottky, the other side of the Schottky diode was 0.45V. Wha?
Also, the value for the FB node advertised on the TPS61085 datasheet is 1.24V, I was seeing a 0.6V that scaled with supply. What's going on?
Atleast I didn't get 2A of current when I turned on the supply:)
Otherwise, the interface works - the Maker has landed - in one week, a GUI running on a PC with it's own serial interface code, talking to the MCU and getting ACKs, MCU commanding the chip in test-mode. Not bad. I feels good.
1) I had left the FREQ pin floating. Wonder how you catch stuff like that without an LVS?
2) I didn't put in a jumper on the supply to the boost - I should have made it easy to cut this thing out - as it turned out I had to use the heat stream to get the chip off and there were still problems after that.
3) Shame on me - knowing about the backgate diode and having PMOS pullups, I didn't put in a jumper to cut the PMOS pullup out - now that backgate diode is clamping on of my comm pins - but, somehow, though the scope doesn't pick it up, the interface still works.
4) I should have put a jumper cutting the inverting boost off from the output of the boost. Childishly simple, but it's amazing what you can not-think of when you're under pressure. Lesson - think modular.
5) I should have put more pads on the board to let me solder some wires to drive these functions from the outside in the event they didn't work. Lesson - think modular and what-if!
6) In soldering (assembly), I should have thought modular too - start off with the boost and see if it's working.
Weird, with an input supply of 3.5, and the chip removed, and supply passing through the boost inductor (3 uH) and then going into the Schottky, the other side of the Schottky diode was 0.45V. Wha?
Also, the value for the FB node advertised on the TPS61085 datasheet is 1.24V, I was seeing a 0.6V that scaled with supply. What's going on?
Atleast I didn't get 2A of current when I turned on the supply:)
Otherwise, the interface works - the Maker has landed - in one week, a GUI running on a PC with it's own serial interface code, talking to the MCU and getting ACKs, MCU commanding the chip in test-mode. Not bad. I feels good.
Sunday, August 23, 2009
Arrays in AHK
To learn how to work with arrays in AHK, read
1) Help docs for StringSplit (tells you the convention - there's nothing set in stone, but you want to let var0 have the number of elements and var1,..,varN have the actual data
2) This great post from meister Infogulch : [lib] pgArray - A solution for Manipulating AHK's Arrays v2
3) Look at the help on Arrays - you can search the Index for that.
To create a string from an array, you're looking at something really nasty like
string =
Loop %var0%
{
string .= var%A_Index%
}
I know, you wish perl was easier to use on Windows, you with AHK was more like perl. But, what can you expect for $0.0? It's a great tool for the price.
1) Help docs for StringSplit (tells you the convention - there's nothing set in stone, but you want to let var0 have the number of elements and var1,..,varN have the actual data
2) This great post from meister Infogulch : [lib] pgArray - A solution for Manipulating AHK's Arrays v2
3) Look at the help on Arrays - you can search the Index for that.
To create a string from an array, you're looking at something really nasty like
string =
Loop %var0%
{
string .= var%A_Index%
}
I know, you wish perl was easier to use on Windows, you with AHK was more like perl. But, what can you expect for $0.0? It's a great tool for the price.
Hello World Arduino GUI
Status :
Basic GUI in AHK to talk to MCU - done
String manipulation to give user visual feedback on chip state - pending
Biggest headache was talking to the serial port in Windows. Sure, there are 1000's of GUI programs out there, but what happens when you want to write a program where you can push a button and get data out? Now you need a lite solution. Luckily, the dons on the AHK forum have cooked something up that calls the buildComDCB DLL from M$. It's not a 'lite' solution, but...
Now I'm faced with a quandary - how do I process data - it was a snap in Perl, but AHK's emphasis is not on data manipulation, so it doesn't give you 'lite' methods :(
Friday, August 21, 2009
Leave Well Alone
I had given up on my USB/serial at home after my outfit's MCU dev board and the MSP430 failed to be installed properly. Learnt later that both used direct USB and I was always pointing windows to the virtual COM port drivers. I try half heartedly to plug in my Arduino today and - pleasant happenings - it works without me having to do a thing. There are some things you have to give M$ credit for. BTW, writing to the COM port from Autohotkey or anywhere (including MS-DOS command prompt) is the last link in my chain. There seems to be a ray of hope thanks to this post which I intend to scrutinize minutely :
Seial (COM) Port Console Script
Thursday, August 20, 2009
Arduino Trumps All
Gave up on my own outfit's microcontroller after the code they have on the website failed to compile on their own assembler. Tough one. Arduino is super easy to use. Great job by the azzuri on this one. The IAR rep who called me to follow up on my download of the kickstart version was also amazed.
One disappointment was that, despite running off a 16 MHz clock, the Arduino cannot put out a pulse narrower than 4 us on one of its output ports. Might need something fancier than digitalWrite to accomplish that.
One disappointment was that, despite running off a 16 MHz clock, the Arduino cannot put out a pulse narrower than 4 us on one of its output ports. Might need something fancier than digitalWrite to accomplish that.
Saturday, July 25, 2009
Sunday, June 21, 2009
RTFM Works
Last gasp accomplishment for the day - Friday. The inhouse software guru spoke - it's just RTFM. Use Zterm on the Mac to connect to the radio. Before that, open up the manual for Roving Networks' radio that Sparkfun is using. I keep claiming to want to be in RF, how come I never did that? Hmmm..
Anyhow, in this case, the Mac never did pair with the modem - needed default passkey, not no passkey. So, Igoe should really have said to RTFM.
What I have noticed with Zterm is this - you can power up the modem and use Zterm to talk to the modem in command mode - as long as TX/RX are not connected to the AVR. If they are, no hope.
Then, if you have connected TX/RX to the AVR and are running the monski pong sensor reader program, you can't get the sensor values - no matter how many /r's you send - which is exactly what the Processing sketch does. Why? If I run the Processing monski_pong_handshake sketch, stuff works fine. And then, once the sketch is up and running, I can interrupt it and go into Zterm and continue reading sensor values using Zterm. What's going on??
Whoops, and just like that, after my friend returns, stuff behaves. I can go into CMD mode arbitrarily, and even read sensor data through Zterm. The trick seems to be to wait a few seconds after powering up the Arduino setup. After that, the Mac has paired with the device and made the serial port available. Of course, once the Mac has seen the device, the serial port is always available. But, if you try connecting to it 5 seconds after you power up the bluetooth modem, you're out of luck.
Anyhow, in this case, the Mac never did pair with the modem - needed default passkey, not no passkey. So, Igoe should really have said to RTFM.
What I have noticed with Zterm is this - you can power up the modem and use Zterm to talk to the modem in command mode - as long as TX/RX are not connected to the AVR. If they are, no hope.
Then, if you have connected TX/RX to the AVR and are running the monski pong sensor reader program, you can't get the sensor values - no matter how many /r's you send - which is exactly what the Processing sketch does. Why? If I run the Processing monski_pong_handshake sketch, stuff works fine. And then, once the sketch is up and running, I can interrupt it and go into Zterm and continue reading sensor values using Zterm. What's going on??
Whoops, and just like that, after my friend returns, stuff behaves. I can go into CMD mode arbitrarily, and even read sensor data through Zterm. The trick seems to be to wait a few seconds after powering up the Arduino setup. After that, the Mac has paired with the device and made the serial port available. Of course, once the Mac has seen the device, the serial port is always available. But, if you try connecting to it 5 seconds after you power up the bluetooth modem, you're out of luck.
Friday, June 19, 2009
Wireless Monski Pong
Alright Mr. Igoe, this is the first one that doesn't work.
When I power up the setup, the LED near the RTS pin blinks (keeps) about 2x a second.
If the MAC has already paired with the device once, then, if you run the program in processing, the LED near the CTS pin goes solid on.
Then, if you stop the program, (it does draw the screen BTW, but no action), the LED near CTS goes off, and the one near RTS starts blinking at 1 Hz.
Very hard to debug this one on the MAC - how to you know what's showing up on the serial port?
A general question about the Arduino board - are the RX/TX pins on the header connected to the same ones that go to the serial-USB adapter chip?
When I power up the setup, the LED near the RTS pin blinks (keeps) about 2x a second.
If the MAC has already paired with the device once, then, if you run the program in processing, the LED near the CTS pin goes solid on.
Then, if you stop the program, (it does draw the screen BTW, but no action), the LED near CTS goes off, and the one near RTS starts blinking at 1 Hz.
Very hard to debug this one on the MAC - how to you know what's showing up on the serial port?
A general question about the Arduino board - are the RX/TX pins on the header connected to the same ones that go to the serial-USB adapter chip?
So Much for Mac's Users Friendliness
I still remember a show on TV 20 years ago touting the Mac's user friendliness with a PC example - "abort,retry, fail?". Here's what I got from the Mac Mini today when I tried to run Arduino :
uncaught exception in main method:
java.lang.UnsatisfiedLinkError: /Useres/xx/arduino-0015/Arduio
15.app/Contents/Resources/java/librxtxSerial.jnilib: no suitable image
found. Did find:
/Users/xx/arduino-0015/Arduino15.app/Contents/Resources/java/librxtxSerial.jnilib:
no matching architecture in universal wrapper
Leaves me helpless.
uncaught exception in main method:
java.lang.UnsatisfiedLinkError: /Useres/xx/arduino-0015/Arduio
15.app/Contents/Resources/java/librxtxSerial.jnilib: no suitable image
found. Did find:
/Users/xx/arduino-0015/Arduino15.app/Contents/Resources/java/librxtxSerial.jnilib:
no matching architecture in universal wrapper
Leaves me helpless.
Sunday, June 14, 2009
Mission A.d : Push Button, Send LED
Accomplishes a Hello World version of Igoe's CatCam program. I can push a button on my Arduino board connected to the Mac and get my PC to send a mail to my gmail. Will post the code soon.
With the help of a software guru of course :)
Basically, following the lead from Tom Igoe :
App running on the Arduino is very simple and just services a pushbuttom press and a very simple handshake with the PC over the serial port, which also serves in the debounce (PC implements a 2 second delay. Yuck!)
PC runs a very simple program (in Processing code) to monitor the serial port and look for the secret byte. When it gets it, it fetches a PHP page from the webserver.
Webserver, services that request by sending a mail using the simple port 25 protocal at mail.google that doesn't require authentication.
Mail will be in your spam folder in your gmail because it looks like an obvious forgery.
With the help of a software guru of course :)
Basically, following the lead from Tom Igoe :
App running on the Arduino is very simple and just services a pushbuttom press and a very simple handshake with the PC over the serial port, which also serves in the debounce (PC implements a 2 second delay. Yuck!)
PC runs a very simple program (in Processing code) to monitor the serial port and look for the secret byte. When it gets it, it fetches a PHP page from the webserver.
Webserver, services that request by sending a mail using the simple port 25 protocal at mail.google that doesn't require authentication.
Mail will be in your spam folder in your gmail because it looks like an obvious forgery.
Saturday, June 13, 2009
VDIG Mirror
The whole setup - Arduino + processing is quite unreliable - no offense to the nice people who've put it together. It lacks the "heavyweight" quality.
Anyhow, for those seeking VDIG - which lets you generate quicktime output from you webcam, here's a mirror:
http://www.eden.net.nz/7/20071008/
Courtesy of Tim Molteno. Hero!
One glaring error by Tom Igoe :
Pg 298 - he's put "myCam" before width in his call to Capture. How????????
Anyhow, for those seeking VDIG - which lets you generate quicktime output from you webcam, here's a mirror:
http://www.eden.net.nz/7/20071008/
Courtesy of Tim Molteno. Hero!
One glaring error by Tom Igoe :
Pg 298 - he's put "myCam" before width in his call to Capture. How????????
The Best Apache PHP Setup Guide in the World
Here :
http://www.reaper-x.com/2007/09/24/installing-and-setting-up-apache-22-series-with-php-5-on-windows/
But, this is a mistake to install just Apache. Later you'll be installing PHP, etc. What you want to install is XAMPP. Check that out!
http://www.reaper-x.com/2007/09/24/installing-and-setting-up-apache-22-series-with-php-5-on-windows/
But, this is a mistake to install just Apache. Later you'll be installing PHP, etc. What you want to install is XAMPP. Check that out!
Thursday, June 4, 2009
Arduino Igoe Monski Pong Prequel
Code for the book Making Things Talk is available online :
http://www.makershed.com/ProductDetails.asp?ProductCode=0596510519
Now, code for the example on Pg 59 is in the file called sensor_reader.
Set Realterm to ASCII to see a presentable display. I used just resistors (no flex) and moved the probe (analog Pin 0 or 1) around VDD and GND to see that max code is 1023 and min is 0. Tells you it's a 10 bit ADC - neat. The last character appears weird it must be said.
With a 1k to 5V and 10k to GND divider, I see codes ranging from 931 to 929 - 2 LSB's of p2p noise. About 10 mV of noise there p2p. That's within the ADC bandwidth. And what is that? Need to check the datasheet there. Gives an idea of the KT/C noise and the active device noise of the ADC? p2p noise is about 6x the rms noise?
http://www.makershed.com/ProductDetails.asp?ProductCode=0596510519
Now, code for the example on Pg 59 is in the file called sensor_reader.
Set Realterm to ASCII to see a presentable display. I used just resistors (no flex) and moved the probe (analog Pin 0 or 1) around VDD and GND to see that max code is 1023 and min is 0. Tells you it's a 10 bit ADC - neat. The last character appears weird it must be said.
With a 1k to 5V and 10k to GND divider, I see codes ranging from 931 to 929 - 2 LSB's of p2p noise. About 10 mV of noise there p2p. That's within the ADC bandwidth. And what is that? Need to check the datasheet there. Gives an idea of the KT/C noise and the active device noise of the ADC? p2p noise is about 6x the rms noise?
Arduino Serial Success
The big tip - screw what Igoe says - don't even look at Putty. Putty was busy with I don't know what when I clicked "Open" - not even a peep.
Go straight for Realterm - probably the best serial comm tool ever written.
Goes without saying - you can't have Realterm looking at your port and use the same port to write to the arduino simultaneously. You'll have to close the port in Realterm first - just press the button.
Go straight for Realterm - probably the best serial comm tool ever written.
Goes without saying - you can't have Realterm looking at your port and use the same port to write to the arduino simultaneously. You'll have to close the port in Realterm first - just press the button.
Wednesday, June 3, 2009
Arduino Interrupt Handling
This stuff worked very cleanly in MSP430. Problem is that people are doing a lot more basic stuff with Arduino at the moment so interrupts don't seem to have caught on just yet.
Anyhow, here's what I was trying to do :
Push the button and get the uC to play the Melody. Didn't work, so then I say just blink the LED. That also doesn't work.
This much I see :
(stuff you have to know is that every program in Arduino has a "setup()" and a "loop()")
I light up the pin 13 LED within loop.
Then, I set the ISR to clear the LED, delay and the light it up again.
Doesn't work - all I see is it clears the LED. Come on, this is really simple.
Then, Lefty tells me that you can't use delay within your ISR.
WTH!!
The goal, BTW, is to get through Igoe's book. Great guy - saw him at Maker Faire. Seems to have done everything I want to do. Now, while the economy's got me down is the time.
Anyhow, 11:35 at night, nailed the interrupt thing - can play Melody at the press of a buton. Now, to try out one serial example from Igoe's book and call it a day.
Anyhow, here's what I was trying to do :
Push the button and get the uC to play the Melody. Didn't work, so then I say just blink the LED. That also doesn't work.
This much I see :
(stuff you have to know is that every program in Arduino has a "setup()" and a "loop()")
I light up the pin 13 LED within loop.
Then, I set the ISR to clear the LED, delay and the light it up again.
Doesn't work - all I see is it clears the LED. Come on, this is really simple.
Then, Lefty tells me that you can't use delay within your ISR.
WTH!!
The goal, BTW, is to get through Igoe's book. Great guy - saw him at Maker Faire. Seems to have done everything I want to do. Now, while the economy's got me down is the time.
Anyhow, 11:35 at night, nailed the interrupt thing - can play Melody at the press of a buton. Now, to try out one serial example from Igoe's book and call it a day.
Arduino Here I Come
Okay, MSP430 sucks, Atmel rules. Yesterday was day one. BTW, Atmel and Arduino rule the Maker Faire (no one mentions Atmel of course). I asked on Dallas guy at the MF if he's considered MSP430 and he said no. No way.
Anyhow, we put Arduino on a Compaq running XP yesterday and the performance was pretty crappy. You click the Tool menu and wait about half a minute.
At some point, we're going to get some smart CS people from Eastern Europe to fix this. Italy doesn't seem to cut it yet.
Anyhow, we put Arduino on a Compaq running XP yesterday and the performance was pretty crappy. You click the Tool menu and wait about half a minute.
At some point, we're going to get some smart CS people from Eastern Europe to fix this. Italy doesn't seem to cut it yet.
Wednesday, March 11, 2009
User Guide
Thanks, that helps. One thought - is there a compiler feature that can tell the user what clocks will be active with the program he has written and what current consumption he can expect? Users, like me, who are novices are more interested in creating apps than in optimizing them. Later, when we start thinking about optimization, we would want to know where the ducks are to shoot. Such a feature in the compiler might make the MSP430 more marketable. It might already exist.
Replying to:
Execution will suspend immediately. Code execution will pickup immediately after the device is awakened. So the lines of code will execute after the device wakes back up. The operating modes are described in Chapter 2 of the Family User s Guide. You can download this from the following link:
http://focus.ti.com/mcu/docs/mcuprodtechdoc.tsp?sectionId=95&tabId=1201&familyId=342&techDoc=6&documentCategoryId=6
Please let me know if you need further assistance.
Regards,
If you have further questions please reply to this email. And see the MCU Knowledge Base located at http://www-k.ext.ti.com/sc/technical-support/mcu-kbase
-----Original Message-----
Sent: 3/9/2009 05:45:43 PM
To: support@ti.com
Subject: eZ430-RF2500 demo app question
I am using this product from TI. My question is about the MSP430. What happens when the following line is encountered by the execution unit?
__bis_SR_register(LPM3_bits+GIE); // LPM3 with interrupts enabled
does it suspend operation immediately and go into a low power mode or does it finish execution of the current program before going into LPM3?
If it suspends execution immediately, how does it make sense to suspend execution during a program containing :
SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_SLEEP, "" );
__bis_SR_register(LPM3_bits+GIE); // LPM3 with interrupts enabled
SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_AWAKE, "" );
or even :
while (SMPL_SUCCESS != SMPL_Link(&linkID1))
{
__bis_SR_register(LPM3_bits + GIE); // LPM3 with interrupts enabled
BSP_TOGGLE_LED1();
BSP_TOGGLE_LED2();
}
In these examples, we say go into LPM3 and then we ask it to do other things. Does execution of the program pick up where it left off? Is there an online location I can find answers to such questions?
Replying to:
Execution will suspend immediately. Code execution will pickup immediately after the device is awakened. So the lines of code will execute after the device wakes back up. The operating modes are described in Chapter 2 of the Family User s Guide. You can download this from the following link:
http://focus.ti.com/mcu/docs/mcuprodtechdoc.tsp?sectionId=95&tabId=1201&familyId=342&techDoc=6&documentCategoryId=6
Please let me know if you need further assistance.
Regards,
If you have further questions please reply to this email. And see the MCU Knowledge Base located at http://www-k.ext.ti.com/sc/technical-support/mcu-kbase
-----Original Message-----
Sent: 3/9/2009 05:45:43 PM
To: support@ti.com
Subject: eZ430-RF2500 demo app question
I am using this product from TI. My question is about the MSP430. What happens when the following line is encountered by the execution unit?
__bis_SR_register(LPM3_bits+GIE); // LPM3 with interrupts enabled
does it suspend operation immediately and go into a low power mode or does it finish execution of the current program before going into LPM3?
If it suspends execution immediately, how does it make sense to suspend execution during a program containing :
SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_SLEEP, "" );
__bis_SR_register(LPM3_bits+GIE); // LPM3 with interrupts enabled
SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_AWAKE, "" );
or even :
while (SMPL_SUCCESS != SMPL_Link(&linkID1))
{
__bis_SR_register(LPM3_bits + GIE); // LPM3 with interrupts enabled
BSP_TOGGLE_LED1();
BSP_TOGGLE_LED2();
}
In these examples, we say go into LPM3 and then we ask it to do other things. Does execution of the program pick up where it left off? Is there an online location I can find answers to such questions?
Monday, March 9, 2009
Surprise! P1DIR and Port_1 ISR
You can't use the push button on P1.2 of the eZ430-RF2500 to generate an interrupt if you have bit 2 of P1DIR set. Nice.
And, BSP_init() - though supposedly a utility, will mess this up. So watch out.
And, BSP_init() - though supposedly a utility, will mess this up. So watch out.
Sunday, March 1, 2009
Stage 3 - Day 2 ATR
Okay, the documentation is horrendous, but, still, kudos to the TI team for atleast putting something together that works. I think they have what it takes to send TXN soaring. But, it'll have to be a team effort.
In the demo app for the eZ430-RF2500, they're using a timer interrupt to wake the chip up and run the join-network, etc. Okay, figured that part out. Also, there's a lot of undocumented stuff scattered around like
__bis_SR_register(LPM3_bits + GIE); // LPM3 with interrupts enabled
without it being really easy to find out what the effect of this will be. Now, if they had a PDF of the source code with hyperlinks... ummm.
In the demo app for the eZ430-RF2500, they're using a timer interrupt to wake the chip up and run the join-network, etc. Okay, figured that part out. Also, there's a lot of undocumented stuff scattered around like
__bis_SR_register(LPM3_bits + GIE); // LPM3 with interrupts enabled
without it being really easy to find out what the effect of this will be. Now, if they had a PDF of the source code with hyperlinks... ummm.
Saturday, February 28, 2009
Stage 3 - Push Button on End Device Toggles Access-Point LED
Turning out to be not so simple as the demo code for the eZ430-RF2500 is famously unmaintainable. Wish some of those folks had been exposed to some structured programming concepts. How's someone to take this :
BSP_EXIT_CRITICAL_SECTION(intState);
}
}
}
}
}
[Wince:(] I'd rather see :
} // if( SMPL_R..
} // for
} // if( sPeer..
} // while(1)
} // main
And it gets better - function definitions without any clues about what the h they do, code snippets in the main() that really should be separate functions... If we don't need to know what they do, why not put them in the .h files? Not the best way to sell MSP430.
BSP_EXIT_CRITICAL_SECTION(intState);
}
}
}
}
}
[Wince:(] I'd rather see :
} // if( SMPL_R..
} // for
} // if( sPeer..
} // while(1)
} // main
And it gets better - function definitions without any clues about what the h they do, code snippets in the main() that really should be separate functions... If we don't need to know what they do, why not put them in the .h files? Not the best way to sell MSP430.
Stage 2 - Push Button Toggles LED on Same Board
Done. There is no quick way. You have to read a few posts and a bit of the datasheets. Nothing like being able to delegate:)
Now, for the big kahuna - probably can just scale down the temp sensor monitor.
Now, for the big kahuna - probably can just scale down the temp sensor monitor.
Stage 1 - Flashing LED on Target Board
Found a thread that helped. I want to first use the pushbutton to do something on the target board itself before going wireless. Before that, Mann muss first ensure he can talk to the LED.
Fortunately, that's a piece of cake if you use the flashing_LED example by Dannenberg. You'll have to change #include "msp430.h" to #include "msp430x22x4.h" as in Adrian's example https://community.ti.com/forums/p/859/2554.aspx#2554. And, you'll have to ignore the warning that derivative and target don't match (MSP4301x11 vs 2x44 or something like that, allow it to continue)
But, moved the target board back to battery, and stuff works. A journey of a thousand miles, etc.
Fortunately, that's a piece of cake if you use the flashing_LED example by Dannenberg. You'll have to change #include "msp430.h" to #include "msp430x22x4.h" as in Adrian's example https://community.ti.com/forums/p/859/2554.aspx#2554. And, you'll have to ignore the warning that derivative and target don't match (MSP4301x11 vs 2x44 or something like that, allow it to continue)
But, moved the target board back to battery, and stuff works. A journey of a thousand miles, etc.
Wireless Hello World
What I define as the hello-world of the wireless world. Press a button here, light up an LED there. Duke's teach-science project tells you how to do this with a 433 MHz link, but you need to hook stuff up with wires and a breadboard. Or you could buy a garage door opener. Or, just use the eZ430-RF2500 from TI and do a little programming.
My goal - push the button on the End-Device target board and light up the LED on the Access-Point board. It's not that trivial since you need to know a bit about the network protocol and such, but, atleast, no messy wires making a lab out of your house.
Access-Point - connected to PC through USB for power only. Awaiting a packet that tells it to toggle the LED status.
End-Device - connected to battery board. Polls (or awaits interrupt from) push button port to send a packet to the access-point with code indicating please-toggle-LED.
What's missing in TI documentation :
Block diagram of the eZ430-RF2500 - how is the MCU connected to the CC2500 - schematic diagram is overkill.
Resources :
SimpliciTI protocol overview
My goal - push the button on the End-Device target board and light up the LED on the Access-Point board. It's not that trivial since you need to know a bit about the network protocol and such, but, atleast, no messy wires making a lab out of your house.
Access-Point - connected to PC through USB for power only. Awaiting a packet that tells it to toggle the LED status.
End-Device - connected to battery board. Polls (or awaits interrupt from) push button port to send a packet to the access-point with code indicating please-toggle-LED.
What's missing in TI documentation :
Block diagram of the eZ430-RF2500 - how is the MCU connected to the CC2500 - schematic diagram is overkill.
Resources :
SimpliciTI protocol overview
Custom USB Apps
Answer to "How to tweak that app that runs on the PC?"
there is a new version of the sensor monitor for the eZ430-RF2500-SEH which includes the full source code and was built using free or open source software. this might be a good start for you:
It was developed using the open source Qt
cross-platform applications framework, QWT, and compiled using Microsoft Visual C++ 2008 Express Edition, which are all freely available.
there is a new version of the sensor monitor for the eZ430-RF2500-SEH which includes the full source code and was built using free or open source software. this might be a good start for you:
It was developed using the open source Qt
cross-platform applications framework, QWT, and compiled using Microsoft Visual C++ 2008 Express Edition, which are all freely available.
Thursday, February 26, 2009
Hello World Done
Took the out-of-box access point device (the one that's in the USB stick) and converted it into an end-device, did the opposite with the end device (one that's plugged into the battery board) and re-ran the demo sensor visualizer app.
This used section 10.2 of the SLAU227D app note (Feb 2009 revision).
I would reword some of it:
10.2 point # 2:
existing :
Select Open Existing Workspace, and browse for the demo application workspace (*.eww) file. The project is available on the CD or at http://www.ti.com/lit/zip/slac139.
Problem :
Windows needs to know that you want to look at extensions for Known File Types (once you've installed IAR, .eww is a known type - and so you will not see .eww, you will only see the other files that are .ewd .ewp (when you select All Files).
Preferred wording :
Select "Open Existing Workspace", and browse for the demo application file "eZ430-RF2500 Sensor Monitor Demo vX.YZ"
Point #4 :
Existing :
Select Project -> Debug in IAR to download...
Preferred :
Select Project -> Debug using the Project menu in IAR to download...
Point #6 :
Exsting :
Select Debug --> Stop Debugging exits the debug mode while leaving the target board executing code.
Preferred :
Select Debug --> Stop Debugging to exit the debug mode while allowing the target board to continue executing the program.
This used section 10.2 of the SLAU227D app note (Feb 2009 revision).
I would reword some of it:
10.2 point # 2:
existing :
Select Open Existing Workspace, and browse for the demo application workspace (*.eww) file. The project is available on the CD or at http://www.ti.com/lit/zip/slac139.
Problem :
Windows needs to know that you want to look at extensions for Known File Types (once you've installed IAR, .eww is a known type - and so you will not see .eww, you will only see the other files that are .ewd .ewp (when you select All Files).
Preferred wording :
Select "Open Existing Workspace", and browse for the demo application file "eZ430-RF2500 Sensor Monitor Demo vX.YZ"
Point #4 :
Existing :
Select Project -> Debug in IAR to download...
Preferred :
Select Project -> Debug using the Project menu in IAR to download...
Point #6 :
Exsting :
Select Debug --> Stop Debugging exits the debug mode while leaving the target board executing code.
Preferred :
Select Debug --> Stop Debugging to exit the debug mode while allowing the target board to continue executing the program.
FET Vs IAR
The Flash Emulation Tool costs $100. But, what does it get you over just the eZ430-RF2500 hardware? Is it only that you can protect the firmware with fuse-blow for production purposes?
How do I download code into the MCU from IAR? I don't see Project-> "Debug in IAR" in the IAR. Maybe that's a typo. Probably means "Project->Debug" in IAR.
How do I download code into the MCU from IAR? I don't see Project-> "Debug in IAR" in the IAR. Maybe that's a typo. Probably means "Project->Debug" in IAR.
In IAR Workbench, Unable to "Set as Active"
Kudos : Brandon E
Problem : App note http://focus.ti.com/lit/ug/slau227d/slau227d.pdf says to right-click on "Access Point" project in IAR and select "Set as Active". But, that option is grayed out when I right click. Is there a physical difference between the access point board and the end device board? I switched them out of the box just to see if I could get the firmware download right as a hello-world example.
Solution : Is the Access Point project name already in bold? Yes? That means it's already active.
There is no physical difference between the boards. Behaviour is entirely dependent on the code.
Problem : App note http://focus.ti.com/lit/ug/slau227d/slau227d.pdf says to right-click on "Access Point" project in IAR and select "Set as Active". But, that option is grayed out when I right click. Is there a physical difference between the access point board and the end device board? I switched them out of the box just to see if I could get the firmware download right as a hello-world example.
Solution : Is the Access Point project name already in bold? Yes? That means it's already active.
There is no physical difference between the boards. Behaviour is entirely dependent on the code.
Subscribe to:
Posts (Atom)