Showing posts with label embedded. Show all posts
Showing posts with label embedded. Show all posts

Monday, 29 July 2013

3 Ghz counter and power detector build Part IV Putting the counter into service

After I had soldered the remaining parts like missing passives the lcd display and user buttons the build process was finished.
Before applying power I measured the resistance of the power lines  and some other important points to ensure there are no nasty shorts hiding somewhere.

The big moment applying power.
Nothing except a short blink of the lcd back light happened .
Hmmm
Soon I figured out there is a very nice software power switch  implemented.
You need to press the ok button to switch the unit on.
Very nice, I will implement that logic in my own designs too.
Power switches are so outdated.

So the unit works. As a first test I measured the power and frequency of an fm test generator.
Without calibration the frequency part worked ok but the power measurement was of by 3 db.
To calibrate the unit I need access to the university test lab, which I don't have until September.

First impressions, pros and cons of the unit:

Pros:
Very nice power on design
Usage of qfn components I lover to solder fine pitched smd devices
Cpld design
Open source software for the microchip and the cpld

Cons:
A usb port to export data is missing
The displayed frequency is always drifting
No gate time setting
Silk screen of pcb is horrible , very fuzzy and partly unreadable (the manufacturer promised to take care of this problem though)

In the end I am unfortunately disappointed of the unit.
On the other hand it still will be a help in the spectrum analyzer build process.
I am also thinking about implementing an serial output.
To log the data in a computer could be a big help. You could for example plot the frequency versus power output of a device and visualize the stability of the power in a given range.

Finally the counter in action (Please excuse the flare on the lcd)


Links:
3 Ghz counter and power detector build Part I
3 Ghz counter and power detector build Part II
3 Ghz counter and power detector build Part III
Elektor project page


Sunday, 28 July 2013

3 Ghz counter and power detector build Part III Cpld

The counter not only has a Dsp that needs programming, there is also a Cpld.
Cplds (Complex Programmable Logical Devices ) are very interesting parts.
A Cpld gives you the possibility to create your own integrated circuit.
In a very simplified explanation I would say they are made of thousands of gate arrays and configurable wires which connect between the gates and the pins.
Programming a Cpld is more like routing a pcb than programming a microcontroller.
A common language to describe your circuit is VHDL (Verilog Hardware Definition Language).

Cplds and Fpga (Field Programmable Gate Array) are very powerfull devices.
They can process tasks massively parallel are very fast but also expensive and tricky to program.

Programming a Cpld is usually done via Jtag interface.
I downloaded the Altera programmer and used a 5$ Jtag programmer clone of the Altera Usb Blaster.

Everything worked immediately .
The last step of the counter build is to add the rest of the passive components.

Successful programming of the Cpld
Links:
3 Ghz counter and power detector build Part I
3 Ghz counter and power detector build Part II
Elektor project page
Altera Homepage

Friday, 26 July 2013

3 Ghz counter and power detector build Part II Troubles programming the Dsp

When I populate a new pcb I first solder the chips with the smallest footprints.
Next in order are the bigger ics and power supply chips.

Then I make a break and program the controller.
To program a Pic chip you just need the chip, some decoupling capacitors a pullup resistor  on the reset line and the three programming data lines MCLEAR (reset line),PGC,PGD.
Usually pic chips are super easy to program, compared to the Atmel Avr line they even don't need an oscillator.

So with high hopes I started  the Microchip ide Mplab, connected the programmer to the board (using pogo pins to avoid solderin a connector) and clicked the connect menu entry.


Connecting to MPLAB ICD 2
...Connected
Setting Vdd source to target
ICDWarn0020: Invalid target device id (expected=0xF0F, read=0x0)
...Reading ICD Product ID
Running ICD Self Test
... Failed Self Test.  See ICD2 Settings (Programmer->Settings) (status tab) for details.
MPLAB ICD 2 ready for next operation

Hmmmm
At least one head scratching hours later, no difference.
The Dsp chip simply told me in this working environment we ar on strike, go f*** yourself.
Now what to do if a processor is in working refusal ?
The best way is to negotiating with their local labour union boss, the datasheet.
In a good datasheet there is often a minimal working environment section and voila there is a strange pin number 7 called Vcap/Vdcore.

Hmmmm

After further reading I understood the internal core runs on 2.5V and to avoid an extra power line the chi provides an internal regulator which needs a decoupling capacitor.

Next try:

Connecting to MPLAB ICD 2
...Connected
Setting Vdd source to target
Target Device dsPIC33FJ32GP204 found, revision = Rev 0x3006
...Reading ICD Product ID
Running ICD Self Test
...Passed
MPLAB ICD 2 ready for next operation
Programming Target...
...Validating configuration fields
ICDWarn0046:  Because clock switching is enabled, MPLAB ICD 2 requires the user to cycle target power after a program operation.
...Erasing Part
...Programming Program Memory (0x0 - 0x54FF)
Verifying...
...Program Memory
...Verify Succeeded
...Programming Configuration Bits
.. Config Memory
Verifying configuration memory...
...Programming succeeded

BOOOOOM
Success, the chip is now programmed.
Now that was some heavy lifting , usually troubles appear from the most unexpected direction.

Time for some pictures:
Dsp processor

PLL chip very small footprint

 Log Power measurement , Cpld and Pll chips

Links:
3 Ghz counter and power detector build Part I
Elektor project page

Thursday, 25 July 2013

GPS Locator

I often read about new Gps receiver which are so sensitive the even get a lock indoors.
Every now and then I believe this rumours buy the unit try it at home and of course it does not receive enough satellites to get a lock sometimes it does not even receive one.

A gps receiver at would be grat, I could synchronise my Rubidium oscillator with the 1pps output, or build a timeserver ,...

 The MTK3339 Gps receiver I tested has a pretty fast fix and there is a breakout pad available which fits on the Launchpad. There is even the option to connect a battery to it so it does not lose its satellite data and only needs a warm start.

When you remove the target processor on it you can use the Launchpad as serial to usb converter.
So you plug the Gps pcb on the Launchpad, start a terminal programm on the Pc and watch the Gps data flow.

Unfortunately no Gps lock at home, but nevertheless a very sensitive and fast Gps receiver.

Gps Locator pcb

Gps Locator bottom view

Links:
Booster Pack shop link
Gps receiver

Wednesday, 24 July 2013

Nokia 5110 Msp430 Booster Pack

Texas instruments is becoming my most used development platform.
The launchpad series is great for rapid development and did I mention the debugger is great ?
Since Ti is such a big company it is somewhat hard to gather the information you need, since they have many technical writers and thousands of documents. They also lack some kind of easy tutorial which just gets you started like the one from Embedded Artists for the Nxp line or I simply have not found it yet.

Edit:
Unbelievable there is a great tutorial site from Ti I just found it within minutes after I wrote this blog,...
http://processors.wiki.ti.com/index.php/Getting_Started_with_the_MSP430_LaunchPad_Workshop



On the other hand there is a great user community and if you have some experience with other controllers you will get used to the controller line soon.

The Nokia booster pack is designed by RobG and it is also possible to build it as a  stand alone display.
I decided to do so, but I had great difficulties to get the programmer to recognize the board.
In the end my reset controller consisting of an resistor and a capacity did not work out. After hours of head scratching guess work I removed the capacity and it did work immediately, very strange.
To program the controller I simply put the board on a launchpad with empty target controller socket.

I tried some example code from the designer and the booster pack worked great.

I usually don't like displays without a character generator,  but once you defined the character set you won't notice a difference, so no problem whatsoever.

The Nokia 5110 display is controlled via Spi bus, so update rates are fast and programming is easy once you get used to the concept. There is a nice lecture from Cornell university which helps you understand the basic concepts to use a Spi bus.

Btw. I decided to build a standalone version, because I can implement a full blown easy to use display controller module and then simply connect any circuit to it to use it, even the interface choice is flexible, from simple bit bang mode to serial or I2C anything is possible. I simply like modular approaches.

Finally some pictures:

Nokia 5110 msp430 booster pack

Bottom side

In action

On top of the launchpad to program the controller


Links:
Spi tutorial
Buy pcb from 43oh shop
Build thread

Tuesday, 23 July 2013

WS2812 RGB Led Matrix Booster Pack

The WS2812 is a highly interesting RGB led, since it already has a controller build in and supports daisy chaining.

Now how does it work ?
You can send 3 bytes of information to the led. Every byte corresponds to either the intensity of the colour red green or blue. 255 translates to highest intensity while 0 turns the corresponding colour of.
So f.e. you have 10 leds in a row and send 30 bytes to them. The first led grabs the first 3 bytes and passes the left 27 bytes down to the other leds. But the led not only passes the bytes down, it also reshapes the signal and amplifies it.. You don't need to worry of signal integrity.

The controller also only needs one data line, so there is no clock signal needed.

There is only one problem, the signal has to be short to get reasonable update rates.
So a 1 is translated to a 1.2us long high impulse followed by a 1.3us long low impulse.
While a 0 is translated to a 0.5us long high impulse followed by a 2. us long low impulse.

So the pulses need to be so fast you cannot bit bang them any more you need a built in hardware module.
Some genius developer on the internet suggested to use the built in Spi bus protocol since it supports fast data rates.But there are still some problems waiting to be solved. In hardware Spi a bit always has the same time frame and either a high or a low pulse.

So you have to map your bit to a matching spi sequence.
So first program the bus speed to 2 mhz. Every bit is now 0,5 us long.
A bit with value 1 now translates roughly into 11000
A bit with value 0 translates exactly into 10000

The bit with the value 1 is not exactly mapped but the processor has a tolerance of +-150 nS so we should be fine.

I tested the code with a WS2812 led light strip I built and it worked.

This is a great example of a developers ingenuity, there is a big problem but thinking out of the box and using an hardware bus protocol which has completely different specs but is fast enough saved the day.

I plan to use the led matrix  as a moodlight, but most importantly I wanted to learn how to use this leds.
I want to use them to display sensor data like temperature and humidity. Blue would translate to below comfortable, green ok and red above comfortable level.

RobG Led Matrix Msp430 Booster Pack


Backside JP1 powers module from launchpad

Booster pack in action
 Links:
Buy pcb
Designers forum thread

Monday, 22 July 2013

3 Ghz counter and power detector build

To measure the output of the phase locked oscillators for the spectrum analyzer I needed a fairly accurate frequency counter.

I test a counter usually against my 10 Mhz rubidium source.
Neither a cheap 1 Ghz counter from China nor a self built counter built around pic micro controller produced good results. They were way of,...

This new project which I found on the Elektor homepage raised my curiosity.
Usually I don't like Eektor projects that much,  they tend to use the most expensive components but then deliver a mediocre circuit that does not make use of all the bells and whistles this components could deliver. On the other hand I like the magazine and always  hope this time they hit gold.

First for pre scaling (dividing the input signal down) it uses a cheap pll chip instead of an expensive dedicated pre scaler. (nice!)
Second as counter it uses a CPLD device and provides the VHDL (Verilog hardware description language) sources.
Third it uses a 0.5 ppm crystal oscillator as reference.
Forth it can measure the power level but unfortunately only within an accuracy of 4 db (if the frequency is modulated). I can live with that, power meters almost always have trouble with modulated sigbak sources .

I ordered an empty pcb, luckily I already ad most of the needed parts in my lab.
In the build process I first populated the most difficult parts like the qfn power detector, the input amplifier and than the rest of the integrated circuits.
Then I soldered the passive components.
Afterwards the big components like the display were soldered.

Before power up I checked for short circuits.

Next step is programming the Cpld and the Dsp about which I will tell you in another blog post.


Counter function blocks
             1) Hf input
             2) Dc input
             3) Battery input
             4) Input splitter (Log detector, Counter)
             5) Log Detctor
             6) Preamp
             7) Pll (prescaler)
             8) Oscillator
             9,10) Linear regulators
             11) Reference
             12) Polyfuse circuit protection
             13) Jtag disable
             14) Jtag (Busblaster programmer input)
             15) Icd (Dsp programmer input)
             16) Cpld
             17) Dsp

Links:
Project link



Sunday, 21 July 2013

Meet the Lpcxpresso

Embdedded Artists did an awesome job around the Lpc Arm processor line from Nxp.
32 bit Arm processors are now  available and affordable for everyone.
All you need is some fundamental C experience, an Lpcxpresso board and to read the Embedded Artists tutorial.

For example I read the I2C tutorial section, hooked up an Lm75 I2C temperature sensor and understood enough about the usage of I2C to write my own character display library based on an Newhaven I2C display.

The productivity using this tool set can be breathtaking.
You use templates from Embedded  Artists, expand the code debug it and you are done.

The code red ide is based on Eclipse so you really get a nice development environment.
There is a huge user base on the Internet and some really great forums.

The debugger works great and you always see what is going on with your source code.

For my hardware designs I meanwhile use only controllers from Ti and the Lpc line if I need 32 bit power. I don't want to work without a decent debugger any more.

In the moment I use the following boards:
LPC1115 board
A Arm cortex M0 processor with 64kB flash and 8kB data memory

LPC1669
A Arm cortex M3 processor with 512kB flash and 64kB data memory
It has a built in Ethernet and can interface and offers tons of features.

I also bought the Lpcxpresso experiment kit, which offers example hardware and software to try the most interesting chip features out.

Once I figured the user rights management on my private git server out, I will provide some example code I wrote for this processor, like my lcd library.

LPC 1115 and Lm75 sensor on a breadboard


The new Jtag V2 interface

Lpcxpresso experiment kit



Links:
Embedded Artists
Lpcxpresso experiment kit
Code Red Ide
Nxp
User Forum

Thursday, 18 July 2013

Embedded Wifi

More sooner than later even simple electronic products will have to support wifi.
The electronic industry finally has recognised the demand and started to deliver easy to use solutions.

To send some data to a server I am not interested to study osi layers and literally thousands of pages from different rfc papers. I simply want to connect open a socket and send the data somewhere.

Available and affordable solutions: 

TI CC3000 module 

A great pitfall today is to connection to the wifi. Until now you needed a pretty serious gui interface just for that one time operation. Texas Instruments created a very nice solution, they added to their CC3000 wifi interface a program where you can set up your wifi client with your handy.
Their api  called Simple Link is easy to understand and helps you to get everything up and running in a second.
You can buy the CC3000 directly from Ti for 35$ including s&h

Wiznet WizFi220 

The Wiznet devices are around for some time now. The WizFi220 low power "Serial to WiFi” module with additional power amplifier is also easy to use. You even don't need an api to run it, you simply send serial commands from your application to the module and the module does all the magic.
There is also a big user community and many examples are available on the internet.
You can buy the WizFi220 for about 25$ but unfortunately s&h to Europe from Wiznet or their resellers is pretty expensive.

TP-Link TL-WR703N 

The hackers choice. The WR703N is a small router whit an available open wrt port.
Unfortunately this device was until recently only available in China and therefore has a chinese user interface. To find the correct firmware update page is not an easy task.

Once you have taken this hurdle you have a nice little wifi enabled Linux computer.
The unit also provides a serial interface on the pcb, you just have to solder some wires to the pcb and a connector. Then you can talk to the device with an micro controller and run some python scripts on the router side to send your data over wifi.

You can buy this device from Ebay for under 20$

I like all three modules and will soon post about my experiences using them.

Links
Ti CC3000 wiki
Wiznet WizFi220
TP Link TL-WR703N Open Wrt page

Pictures:

From left to right: CC300 Booster Pack, Wizfi220 and Antenna, TP Link TL-W703N

TP Link router inside case



Friday, 12 July 2013

How to solder QFN chips like the MSP430FR5739

The new MSP430FR chip line has interesting features like embedded non volatile fram and ultra low power consumption. The chip is available in TSSOP38 or QFN40 package.I simply had to try them out.

Usually hobbyists  are repelled by the very small case and the missing pins.
But once you get used to work with the QFN package you start to prefer it over any other packaging.
Since they have no visible pins, they cannot suck the solder up via capillary suction and create ugly shorts.

To solder a qfn chip you buy a breakout board and put a small amount of solder paste at the pcb.
Beside the solder paste you add some solder flux (very important).
Then you place the chip on the board and roughly align it.
With an heat gun you slowly heat the chip and board until the flux starts to melt.
This is a very important phase because the chip will swim on the fluid and align itself correctly.
Now heat it up until the solder past melts and you are done.

The next problem you will face is how to check the correct alignment and if all pins are correctly connected to the board.I use a multimeter for that purpose. Usually the pins have a certain resistance around 5k to 1mega ohm. Measure all pins and if there are shorts suck them away using some solder wick.

Once you get used to Qfn packages and are able to solder the chip  correctly it will only require about two minutes of your precious spare time. Soon you will start to enjoy working with Qfn packages.

MSP430 in QFN package compared to a Dil20 chip

Links
MSP430FR5739
Fram
Demo video

Saturday, 6 July 2013

Cypress PSOC4

Cypress PSOC4 Electronics embedded programming C


Today I explored a new microcontroller system from Cypress called PSOC (Programmable System on Chip).
I bought a devkit from Farnell which costs about 20€ called CY8KIT-042.

Cypress Dev board


The programming process is different, you program them with the usual C code you have an integrated debugger, but you can also program your functions with a graphical interface.

F.e. the typical hello world micro controller program, a blinking led:

Graphical implementation of the blinking frequency using pwm (pulse width moduation):







Mapping of the led pin to the graphical Pin_1 component




Calling the component using C code

void main()
{
    for(;;)
    {
         PWM_1_Start();
    }
}

Compiling and Programming the device

Project finished

 A very interesting concept, worth further exploring.

Links:
Cypress Psoc4 community projects