Saturday, January 19, 2013

Discovery Board is Working

Last week, I got the compiler compiling code. This week I got the discovery board talking OpenOCD. Life is good, now I just gotta figure out a protocol for sending data back up the USB port.

The engine monitor is on the back burner again. I want to build an IMU, since I have this board. If I can build an IMU, I should be able to build a little glass cockpit type display, similar to the Dynon or other EFIS app for the Android. The discovery board doesn't have any pressure sensors, but has a 3 axis gyro, a compass, 3D accelerometer, and a bunch of LEDs.

Using the gyro's, compass and accelerometers I should be able to build an accurate atitude indicator, a turn coordinator, a directional gyro indicator. If I can add pressure sensors, I should be able to build the whole "6-pack" from a standard instrument panel.

The secret to OpenOCD was at this site. Don't build the ftdi stuff, unless you have the ftdi dongle. If you are talking to the Discovery board, all you need is "stlink" that has been in OpenOCD since version 6.1.

The open pilot site has some resources for the discovery f3. There is a quad copter built using one.

Life is funny sometimes. Telnet, something I rely on, it is just there on all systems, old DOS (with some network kit), windows, all the unix systems I've used, mac and linux. For some reason, it isn't part of the default installation of Mandriva linux. How does one do anything without telnet. A simple urpmi and I have it, but weird!!

Anyway, I don't know if I added a link to this page, but it has a very high level set of instructions for building and loading software on the board, including using OpenOCD. He does:

openocd -f /usr/local/share/openocd/scripts/board/stm32f3discovery.cfg &
telnet localhost 4444
reset halt

flash erase_sectors 0 0 127
flash write a.out 0x8000000
 

To make that work, you really need to use the '&' to put open OCD in the background or use another terminal to do the telnet. Then you need to use different commands (maybe he had another version):

openocd -f /usr/local/share/openocd/scripts/board/stm32f3discovery.cfg &
telnet localhost 4444
reset halt

flash erase_sector 0 0 127
flash write_image imu.elf 

I havn't figured out what offset to write the image yet. There is another version of write:

flash write_bank bank_id filename offset
        Write binary data from file to flash bank, starting at specified
        byte offset from the beginning of the bank.

I think that will be something to play with in the future. The test_image shows it at 0x0800000, which may have been a typo from the initial site.

test_image imu.elf
address 0x08000000 length 0x000004cc
address 0x080004cc length 0x00000028
verified 1268 bytes in 0.000318s (3893.966 KiB/s)
The darn GDB doesn't work though. It was built expecting libncurses.so.4, and I only have that version in /usr/lib64.  I'll probably have to build that too, now. The demo code only increments a value by 5. Probably keeps the CPU pretty busy! Good way to test the debugger once I get that running.




 
The JXD S5110...

Well, it lived a hard life. It isn't dead, but well on the way. Today it was dropped, and the screen broke. This seems to have rendered the touch screen completely useless. I cannot figure out how to make the touch screen usable. The emulated games to work though. They mostly relied on the buttons around the screen, and they still work! The buttons emulate certain screen inputs, so you can unlock the device, and navigate the icons to select the games. It is funny, you know it is android, and you want to touch it, but that doesn't work. The joystick on the side does most of the driving, and the select button selects things. If someone made a good bumper for it, I'd probably buy another one.

Keep building

Sunday, January 13, 2013

Android Christmas


For Christmas, my older son wanted a phone. Without any influence, other than he couldn't have a Galazy Note or an S3, he wanted a Motorola Backflip, or any Galaxy phone. (I think he knew that I wouldn't buy him anything from Apple). We weren't going to pay for an unlimited plan, so I thought it reasonable to get an unlocked phone, and a pay as you go plan. Our older son and daughter went halfs on an unlocked Motorola Backflip. At first I thought this a great idea, but the backflip is so attached to ATT, that we can't load too many useful third party apps on it. I let him use my myTouch 4g until I can get this worked out a little more.

My other son got a JXD S5110 android gaming device. If you have never seen one of these, they are pretty cool. It looks just like an older PSP, with all the same buttons, but without the CD drive in the back. There is a circular Android logo on the back, that makes it look like a PSP. It has a large screen and a ton of software loaded on it (emulators mostly, Mame, N64, GB, etc). It has Ice Cream Sandwich, but you have to load the play store on it.

99% of everything I've loaded on it works. He plays temple run, cut the rope, and NinJump mostly. It has a multitouch resistive screen, and works amazingly well. You have to push, but overall, it impressive how well it works. One thing that doesn't work is Youtube. I can't tell you why.

The JXD X5110 is fragile. He dropped it the first day, and broke the WiFi switch. Why it has a physical switch, I can't tell you, since it is also software controlled. The back comes off of the device easily, so I soldered across the WiFi switch, so we don't have to deal with that. Over the next week, he has dropped it a couple more times, and knocked the power switch loose, and both of the top buttons. The power switch is about the size of a grain of rice, and the left/right buttons are larger push buttons. I was able to re-solder them on. I am guessing they probably flow soldered them with solder paste (RoHS and all). I used plain old 60/40 lead solder and a 15 watt iron. Nothing to it, maybe like 20 minutes total time (it took a little time to find the power button, since it is about the same size as the screws).

I don't know if I mentioned it, but my wife and I both got Galaxy Note 2's a couple weeks before Christmas. That was a good choice, I really like the device, and with the big screen, it makes everything else seem tiny. I haven't done any programming for it yet, but I want to try, especially for the side by side two apps at a time work. I've got podkicker on that, and been listening to the GoogleIO podcasts from last summer. I mostly listen to +All About Android and +Android Central podcasts for insite into future and device considerations. 

I've done a little work to get a development environment setup for the STM Discovery F3 boards I have. I tried really hard to build GNU toolchain from scratch, but eventually gave up and got the Code Sourcery from Mentor Graphics. It is all setup, but havn't built anything to install yet. I am tempted to use the Discovery boards for the processor for the engine monitor, instead of the Arduino. It'd just be nice to move on from 8bitters finally.

I also was working on pinewood derby, and plastic models, and all. Not much time for watching TV, but I want to play with the SDR again. I've kind of let all that go since last summer.

keep in touch. 


Sunday, November 25, 2012

I am getting excited

Earlier in the week my chips showed. They came from California, not from up the street. Wow, they are tiny, but that is ok. I've decided this is going to be a prototype, and if things are working, I'll do a board layout, and have a short run of boards made. Maybe do a kit, if anyone wants one. This being a holiday weekend (Thanksgiving), I didn't do anything but think about things.

I did go look a new phones. I am really excited about the Galaxy Note II. Close to a tablet, but then it is still a phone. It does fit in my pocket, and the stylus seems really useful. I played with one at the mall on Friday, and I really liked it. More to learn, but overall the same Android that I know and love. More to see and a smooth briht screen.

Speaking of Android vs. Apple again, one of the other Cozy builders talked with one of the autopilot manufacturers who said, Apple doesn't want liability for any control software, so Apple won't let anyone add an autopilot app to the iTunes store. My comment was, the Android eco-system is just getting ramped up, with multiple sizes and configurations. Unless Apple has something significantly better than Siri, they are always going to be playing catch-up to Android.

Discovery Board - Autopilot

Hack-a-day again cam through. They had links to the STM discovery F3 board Linux tool chain. Not for building Linux on the board, but for building apps for the board in Linux. The board has been sitting in my bedroom on my night stand for the last month. I was excited about getting it, but no time. Hopefully some time will be available real soon now, especially with the availability of OpenOCD for the F3 ready to go.

The DIY Drones guys had a Black Friday sale. I was looking and thinking, they have whole FMC (flight management computer) for about $150 on sale. I certainly can't build one for that much, including software, given my time.

My Christmas wish...more time, and closer to my airplane.

happy holidays

tom


Wednesday, November 14, 2012

I just gotta say something...

A product review, if you will.

I got an "Fly Air Mouse" for the Mk808, and am mostly unhappy with it. The accuracy isn't that good, and it doesn't function all the time. The keys bounce, and the some of the buttons don't always do what it says.

There is a nice bluetooth to USB dongle that just plugs in the Mk808 and it all woks fine. The instructions aren't really clear. You need to push the Android button down half way, to use it like a mouse. The full press means select, similar to the left mouse button, but it doesn't always work.

There is a full keyboard on the device, that can be very nice. searching for netflix videos, or entering something in a web site. You need to be careful, the keys bounce. You might be typing in a simple word, say "columbus" and it comes out "ccollumbbuus". I am never sure, and still pressing the delete or back space, and that key will bounce. Getting back to the first "c" may erase the whole word.

Actually I think the best thing would be a simple wireless mouse. The on screen keyboard on the Mk808 is really solid, and almost everything can be done with the left mouse button.

I don't want to complain about anything, or make the world think that this is completely useless. It can be usable, but I probably won't use it much.

That is all for tonight.

tom

Sunday, November 11, 2012

I got a couple days...

Before the MAX31855's show up. So I can afford some distractions. The STM32F3 discovery board I ordered showed up. This board will probably be pretty useful. I still want to do some instruments, and this could be the strap down IRU maybe. It seems to have enough GPIO pins on the board to maybe even be an air data computer by adding a couple pressure sensors to it. It only has USB IO so connecting it to an Android might be a challenge.

I've been listening to the GoogleIO podcasts and the Android library has a nice IO library that allows similar calls for Bluetooth and USB. I think it requires 4.1 though, and may or may not have backward compatibility. I really feel I missed out on this years conference. I don't know why it wasn't even on my list this last year. They gave away a really cool ADK kit that is like an alarm clock, but allows many development options, including demo code for connecting euther Bluetooth or USB.

I figure between the ADK libraries and some demo code for the STM32 discovery board, I ought to be able to connect them together. I need to play with USB hubs though. The physical connectors are either USB minis or USB micros and nothing has a A connector. The discovery board has two USB mini connectors, and the tablets and phones have USB mini connectors. I believe the phones support USB On-The-Go so that should work, but I still need a cable. That is there I think the HUB would work, since I have plenty of A to Mini and A to micro cables.

Sure enough, once you start looking, good things happen! There are A female adapters to mini and micro B connectors, or individual ones. This is going my way now.

Some phones have gyros, and most have compasses with accelerometers, so why have this board in the plane? Few tablets have gyros, and that is what I want in the dash of the plane. The compass may not work in all orientations, or near whatever is in the panel either. Having this board allows placing the gyros and compass in known good locations, and having the air data information integrated will allow any tablet to be used, and know it will work at all times.

I may not finish this in the next couple days, but that is OK. I have plenty to follow up on, and read about and plan. Give me a couple months, and I think I'll have something working.






Friday, November 9, 2012

Back to the Original Purpose


Enough with the SDRs and Chumby's and other distractions. Well, mostly...

I've been a subscriber to EE Times for probably 20 years. It used to be a weekly paper like format, but is now a skinny magazine, but with amazing web bits to supplement it. A couple weeks ago, there was the an invitation to a webinar on RTD and Thermocouples put on by Maxim. The webinar happened on Wednesday, and I listened to it. Pretty good talk, the speaker couple have been more exciting, but was well prepared, and talked about some good products. He didn't convince me to switch to RTD's but I am now thinking of using an integrated SPI chip to do everything.

The webinar hammered into me the reason for the second temperature sensor at the cold junction. The reason is, that ends up being a second thermocouple, since the copper wires that we are connecting to are of different material than the wires in the thermocouple. If we don't know that temperature, then the actual temperature we want to measure will be off a bit. Having the second temperature sensor will add to the complexity, and cost of the circuit.

The one complex circuit presented used the MAX6126 for voltage reference, and DS600 for the cold junction temperature sensor and the MX7705 for A/D converter. There was some discussion about keeping a constant current source, and other details using these three chips to get a good measuring circuit.

Then he showed the MAX31855, wow, pretty simple. Connect the thermocouple on two pins, some power on a couple more pins, a crystal and capacitors on other pins, and then the SPI to the processor and you are done! About the simplest convertor I have seen for under $5! It does SPI, so I should be able to piggyback 8 or 12 or 16 depending on engine chosen. I won't have to use up the A/D convertors to get past a 6 cylinder engine. There is an SPI library for the Arduino and everything.

Now I am still dreaming, I need to actually build something. I need to order about 8 of them, 4 J type, and 4 K type. DigiKey has them for about $3.55 each, but only if you order 2500 at a time! Single quantities are over $7.50 each, and hard to come by. Maxim is generous, and offers them as free samples. I was able to get 2 of each that way. Well, I ordered them tonight. They are just up the street, well some part of the company is (right down Beltline on Midway in Addison, probably 5 miles west, yup google maps says 4.7 miles).

Another toy


This is sort of related, since it is Android. I got an Mk808 android device. I say device, because I am not sure how to categorize it. It plugs into a HDMI port on a TV or monitor and uses that for a display. Otherwise it mostly acts like a tablet processor. There are no g sensors or touch screens, but you can plug in mice (or bluetooth mice) and control the desktop that way. It can run crackle or netflix, and youtube so it is good for an entertainment device. It has a browser (two), and can read and write office like documents (or use google docs).

So what you say, I can get a tablet and do all that. How about replacing your PC with one of these? What would it hurt? You say you can't download photos to it, no you probably can't. You can't play games on it? Well, my kids are driving my wife nuts playing angry birds. You can download all kinds of games. It has the whole google play store on it. Games, apps and media are all available.

What if you wrote desktop type apps for it. Why not, you know, a 32 in 1080p monitor would be way cooler than two 20 inchers, there would be no line, and the mouse would smoothly slide between windows.

What does a desktop PC cost, $400, maybe $1000? Well this is under $100. Yes, that is right, 1.6GHz processor with 1GB memory isn't much, but it might be worth a try? EBay has 'em for about $50 if you want to experiment and don't want to blow too much. Get one of the fancy wireless keyboard mouse combos and you have a full multimedia center. Cut the cable and do some fun stuff.






Thursday, November 1, 2012

Chumby Links, and Tips

People are starting to ask me questions about the Chumby. I am not sure what to think, but rather than getting asked the same questions dozens of times, I thought I'd offer some answers ahead of time.

How did I load my software?


You can start up an SSHD on the Chumby. Go to the about device screen in setup and click on the pi symbol in the upper right corner. Using something like putty on windows, or ssh on linux/mac command line, you can connect as the root user. On my chumby, I connect by typing:

   ssh root@192.168.2.10

or
   ssh 192.168.2.10 -l root

By default there is no password. You can add one, but on reboot, the sshd turns off, and no one can connect. There are instructions for adding passwords on chumby tricks web site. Actually that page has lots of useful links.

I am an emacs user. It is a wonderful tool/IDE/editor. There is no emacs on the stock chumby. I used my laptop to enter the code, this provided me a place to backup the code, so now it is on both the Chumby and my PC. I then cut-n-pasted to a simple vi session on the chumby.

Of course Perl is already there, and all I needed to do was write some code it could interpret. Yes, interpret, but trust me, well written Perl is stinking fast. I've done some image processing using it, it is fast enough.

Where did I store my app?


There is a micro SD card in the Chumby. It can be removed, and I imagine you could load your code on there. You don't need to, you can use the read write file system /mnt/storage to put your code on. I made a sub directory and called it bin, to be standard with the rest of *nix. (If you want to learn about the philosophy behind Unix/Linux etc, the book The UNIX Programming Environment by Kernighan and Pike, read it study it, and you will be the best programmer ever).

How to start the app?


Every time the Chumby boots up, or any *nix system starts, it runs some fixed sequence. There are some scripts in /etc/init.d that has the scripts. I didn't use them, because that partition is read only. You can do a mount -o remount,rw / on that partition, and put in your script. 

I did it the old fashion way; using the command line. Unix is funny, if you start an app on the command line, and the terminal that that app was started from the app goes away also. There are things we can do to get around that. The nohup command is how we ignore the hangup signal when the terminal goes away. Just start the program prefixing the command line with "nohup" and end it with an ampersand "&", and the program will keep running until it gets a fatal error, or the computer reboots.

Another way to make an app keep running after the terminal goes away, involves fork and exec, and a disoconnect. The Stevens book Advanced Programming in the Unix Environment (another book you should be at least familiar with if you want to be a great programmer) has that answer.

Sending Mail 

Oh boy, how does mail work. The chumby acts as a client to a mail server. The mail server is usually called the "SMTP" (Simple Mail Transport Protocol) server. Your ISP probably has a SMTP server that you can use, or google users can use the Google one. The sendmail program on the chumby is the client program that talks to the SMTP server program. The SMTP server will help route your message to the appropriate next hop on the way to the mails destination.

SMTP servers have many options. Some require authentication, some don't. You will have to read all your server documentation to figure out what kind of authentication (if any) is needed. Sendmail can handle most, maybe not in the orientation you are thinking. Like sometimes you need the ssh port, other times it will leave everything visible.

There is some documentation about connecting to gmail at:

     http://forums.fengoffice.com/index.php?topic=190.10;wap2


If it isn't working, run the sendmail command using the strace. Something like:

   strace sendmail cozytom@gmail.com -f sender@example.com  -S smtp-server.tx.rr.com -au senderusername -ap senderpassword < mail.txt

The output will be pretty chatty, but you should be able to see any errors or find clues as to where it is quitting. 


There is probably more to consider, but that will get you started anyway.