Monday 23 February 2015

Wifi Cam - Stage 1

23/02/2015
Wifi Cam - stage 1

Moved into designing my own PCB, used ST32CubeMX to choose functional blocks to I can get pin-out. Ordered components, mostly laid out.
Sticking points:

I would like ESP8266 with flow control (RTS/CTS), I don't know if that is possible with SDK and broken out pin sets, need to investigate.

I am not sure enough of use of BOOT0 pin, need to figure it out, not clear from datasheet or Discovery.

28/02/2015

ESP8266 has RTS/CTS support with latest SDK, but it's on pins not available on ESP8266-01 but are available on ESP8266-03. Alter design to wire up ESP8266 instead of plug in, that way I can use any.

Sussed BOOT0 pin, just needed pull-up.

Laid out PCB, bit busy, bit tight, etched. Not drilled, not loaded, plucking up courage.
Pics:

It's just under 46 x 28 mm, bit bigger than I wanted.

15/03/2015

Ouch this is way more complex than I expected. I've made about 7 interations of the PCB, mostly problems with tracks too close together for reliable etching. Last iteration I built everything then could not get it to work. This time I've widened all gaps between tracks, used Eagle default values to check clearances etc. It still had a few shorts but all fixable, then I loaded in sections:
3V3 LDO
  Applied 5V to PCB input, tested to ensure 3V3 output ok.
Added 5V (Input) and 3V3 output capacitors.
  Applied 5V to PCB input, tested to ensure 3V3 output ok.
Added 12 MHz crystal and capacitor.
  Applied 5V to PCB, checked crystal output was OK.
Buzzed all VDD and VSS processor connections adding Vias where needed.
Added all required processor related capacitors and resistors.
  Applied 5V to PCB, checked 3V3 on all VDD processor pins.
Added LEDs and drive resistors, buzzed out circuit to processor.
Added LINK cable (for programming using ST Link / ST32F4Discovery).
Soldered on 100 pin QFP processor.
  Got some bridges (ok, I ran out of patience after 25 pins), ran out of solder wick, awaiting RS order.
  There are a few ways to solder a QFP processor:
    1) Solder paste and heat gun - out, still awaiting solder paste arriving from China (£2 from China,
        £17 upwards Farnell /RS)
    2) Hand solder very carefully - This was how I started (0.5 mm spacing is damned hard).
    3) Hand solder quickly then remove excess solder / bridges using solder wick.

One 3V3 point in Schematic was not named '3V3', so not joined to 3V3 rail - fixed PCB, linked current iteration.
Missing Gnd connection on Link - fixed PCB, linked current iteration.
 

RS Order should arrive Tuesday. Clear bridges, test whether I can program the beast. Got red, yellow and green LEDs, so I can play traffic lights.
I'm using tried and tested tool chain I used with ST32F4Discovery, so that is fairly safe.
I have created a TrueStudio project using STCube, I should be able to transfer settings / files in sections.
Once the programming works then load SD Card parts of circuit and test. Then ESP8266 (Wifi) parts of circuit then test. Then OV2640 (camera) supply components and test. Finally get OV2640 working.
Then I can do some final software.

22/03/2015

Abject failure. Programming doesn't work. This is a project milestone, so I should have treated with more respect.

I've found (and fixed) errors on the PCB:
When creating multiple supply rails in Eagle circuits, you must make sure to name all the nets the same, e.g every net connecting to a 3V3 rail must be called 3V3. every net connecting to a GND rail must be called GND. If you miss one then it all looks fine, but you won't get a routing on PCB to connect to wrongly named nets. I had 1 wrong, so 1 MCU pin and associated decoupling cap was not connected to 3V3, fixed circuit, modified PCB layout, linked PCB.
BOOT pin needed a pull down resistor, not a pull up, fixed circuit, modified layout, linked PCB.

But still no luck with programming, thought it may be use of Discovery as LINK, borrowed at known good LINK from work. Not that.

All I can think is that circuit still has some problem that I can not find (I think low probability) or I cooked the MCU.
My soldering used to be very good. 20 to 30 years ago I worked assembling PCBs, I developed over time to be quick and accurate, assembly times were monitored and I was encouraged to be faster - hence quick. Quality was monitored by QA inspection and all suspect joints were returned to me for fixing encouraging accuracy. I'm not just saying my soldering was good, that was a fact.
But at that time it was all leaded, I have only R&D experience of soldering surface mount and not much of that. As I said above, I carefully soldered 25 of the 100 pins, then blanket soldered the rest and used solder wick to remove excess, that probably cooked and destroyed the MCU.

I'm now in thinking mode:

I need to improve my surface mount skills. I have a heat gun, though it's a cheapie and I have no idea what 1-8 relates to in true temperatures, need to experiment, gun is good, but need to play. I have no solder paste, on order from China, 1 not arrived, ordered more but takes time.
These made me pretty ashamed:
Doesn't that look quick and easy, he must have been doing that for a long time to get that practised.
Explained in more detail here:
But it's a sales pitch, they want you to sign up for their courses. So it purposefully leaves out the details.
All soldering irons these days are temperature controlled, but you need to set them for the temperature of the solder type you are using and the pad type. If it's linked to large copper area then it acts as a heat sink, so you need higher temperature, too low and it takes ages to heat up to get solder flowing and there is a good chance of chip damage, too high and it heats up quick but there is a good chance of chip damage, needs experience to know exactly what temperature setting and that's also linked to soldering iron. They recommend a soldering station and tip, they don't mention temperature setting or solder type.
Solder / Solder paste comes is a variety of  temperature ranges, This is done on purpose for manufacturing, you can choose to manufacture in stages, use high melting point for first stage, lower melting point for further stages. It allows things like piggy backing, you can make a chip package with pads on upper surface, this allows you to say piggy back flash or RAM on a chipset.
But this just adds complication to home users.
Ionizing is a problem, they do mention wiping pads before soldering with "isopropyl", but they don't say which, I'm guessing isopropyl alcohol rather than accetate, but I am not sure this is important.
The video quickly shows application of flux solution but it's not mentioned, I think this maybe crucial to getting the joint well made and the solder stay on the joint rather than cause bridging. Which flux solution is very difficult to determine using Google.
But I need to improve my chip soldering technique.

Do I now go back to bread board? Should I have bread boarded first? I've knocked up a quick bread board for the MCU in Eagle, but not made it.
Do I create the new fixed PCB, solder MCU first very carefully, carefully add minimum single components, supply 3V3 from bench PSU and test programming first?
The MCU chips are £7 each, I ordered 3 and I have 1 left. They only appear to be available to me via Farnell and it's minimum order £20.

So, I'm thinking and doing nothing.

Later the same day....

Eureka, bit the bullet, make the PCB.
Did it all, high quality quite happy, etched cleaned, drilled cropped.
I could not line up the MCU, checked out the library foot print, ok horizontally but lost a pin vertically, 25 pins in 24 pin space, really screwy. Then I sussed it.
I have a Samsung ML-2240 mono laser printer that I picked up off Ebay some years ago for £10.
Recently while playing, I found the advanced settings, it was on 'normal' 600 dpi, I set it to maximum 1200 dpi. Now looking it up, it is 1200 dpi horizontally and software interpolated 1200 dpi vertically!!!! Switched back to 600 dpi, printed on paper the circuit is now correct. Maybe this has been my problem all along. But wasted a PCB, ah well....

24/03/2015
Nope, no good, adjusted soldering iron down to minimum, very carefully soldered on chip, fail, short. Adjusted hot gun temperature to minimum then carefully removed chip, the soldering was dreadful.
Now awaiting stuff:
  • New soldering iron tip, close as I could get to one used in videos above, chisel, 3 mm across, 45 degrees instead of 60 degrees, but close enough?
  • Solder paste.
  • Liquid flux.
  • 20 off 0.5mm spacing FFC FPC connectors.

I'll practice lots and refine my technique then get it right.
I have a sneaky suspicion that nobody is hand soldering QFP 100 components, I think they use solder cream and reflow ovens and that is on manufactured roller tinned PCB, not bare copper self etched.
Well, anyway, that's what I'm telling myself to keep my confidence from dropping through the floor.




  



Tuesday 17 February 2015

ST32F4Discovery

I'm going to use the STM32F407VGT6TR chip for my IP Camera. It has built in Camera Interface allowing up to 54 MHz pixel clock. It has built in SD Card interface. It's fast. The chip costs near £7.00 which is more than I'd like, but I need the high end functionality.

Camera Interface is not a 'standard', there are 2 types:
MIPI CSI is Camera Serial Interface, sub-LVDS very low noise, very fast serial, good luck finding this anywhere, it is protected by MIPI, you won't easily find camera modules or chipsets that support it.
Parallel Camera Interface, this is appearing more but still rare. Try searching for ARM or Cortex with Camera Interface, try searching RS or Farnell or any supplier, see if you can get a list of ARM based chips with Camera Interface. Basically I had to go through lists, pull up datasheet and check for Camera Interface for each chip.

I got bored, so STM32F407VGT6TR may not be the cheapest available, it was the cheapest I found within my boredom threshold.

-------------------------------------------------------------------------------------------------------------------------

ST produce fabulous little development platforms, ST32FxDiscovery, look them up, they are pin compatible, 1 per microprocessor family, packed with features and cheap, I bought and am using at ST32F4Discovery, £11.75 from Farnell. It has a built in 'ST-Link', which is ST hardware interface for programmin/debugging their chip sets. You can buy an ST-Link on it's own from Farnell for only £68.60!
I can use the ST32F4Discovery for development, then I can use it again in 'ST Link' mode with my own PCB design.

Ok, so ST32FxDiscovery is fabulous hardware, then you come to use it. ST do not like or support hobbyist, there is not enough profit margin in hobbyists, so they don't want to support them. The platform is for company development, not for hobbyists. There are tons of free software resources to attract companies, but they are all based around commercial IDEs, these are:

Altium: TASKING VX-Toolset: They won't actually give you a price for their IDE, you need to fill in a form then a salesman will contact you. A press release states pricing starts at $1,795.

Atolic: TrueSTUDIO: Supposedly there is a free lite version, but I couldn't find it, normal is pro for 995 Euros.

IAR: EWARM: Baseline $1295

Keil: MDK-ARM: Farnell, starts at £472.

-------------------------------------------------------------------------------------------------------------------------

But there are ways, I have Eclipse IDE plus GCC setup using Google and Internet, in 1 evening I have a project that I can flash and debug on STM32F4Discovery, though it only flashes an LED.
ST have a nice utility called STM32CubeMX, you can visually configure what you want to do then it puts together software building blocks to give you a really good head start. Only problem, it supports only the IDEs already listed :-(
Atolic TrueSTUDIO is actually Eclipse plus GCC, so I am thinking that maybe I can create software that converts STM32CubeMX output for Atolic to work in my environment.

But basically I am playing with tools when I really want to be making an IP Camera. Ah well, another challenge :-)

-------------------------------------------------------------------------------------------------------------------------

23/02/2015
Went well, got working tool chain, building and flashing ok, should be able to use Discovery as ST-Link for flashing my project, didn't do anything spectacular just variations on blinky.