04/13/2017 at 02:42 •
I know it's been a while but I finally got around to sending v1 of the GPSDTx board to the fab. I used Elecrow again as they are consistently the lowest cost for up to a 10x10cm 4-layer board with a solder stencil. $100 for all that and it will be at my door in about 10 days from when I submit the design. One sad thing is they are now charging $5 to have a board color other than green (the different colors used to be all the same price). Anyway, I'm looking forward to getting this in, populated, and running code.
Aside: if anyone knows how to easily and efficiently implement USB on the STM32F4s, I'm all ears!
As always, the DipTrace files and gerbers are on Github. If you look immediately when this log is published, look on the branch develop. If there is no develop, then I have already merged into master.
12/08/2016 at 17:56 •
So as best I can tell, everything is workable with a bodge wire here and a cut trace there on Revision 0, however, there are many things that I screwed up or didn't do optimally that I will discuss here and will include in Revision 1 going forward.
- Change the 25MHz TCXO to drive the uC directly.
- The DFU USB Bootloader cannot run using the internal RC oscillator, it requires an external oscillator.
- The uC can output the High Speed External Oscillator (or many other clock/PLLs/etc) on it's pins.
- Output HSE oscillator on pin PA8 and drive the Si5351 with that clock source.
- This still gives a good 25MHz to the clock gen which can then do its thing
- Also allows USB Bootloader to work
- Drive the clock and write lines on the DAC directly from one of the Si5351 outputs.
- The DAC datasheet says that they can be tied together.
- I had originally driven them separately from uC pins for greater flexibility (turns out this isn't necessary)
- Si5351 driving them can give a deterministic and low-jitter sampling clock.
- Feed that same signal driving the DAC clock and write lines into an external interrupt pin on the uC
- Have it drive PA0 to get a high priority external interrupt
- The DAC samples the data and select (determines whether data is for I or Q) lines at the rising edge of the clock signal.
- They only have to be stable for 2ns following the clock rising edge, which is less than one uC clock cycle.
- Setup the data and select lines, as soon as you get the clock PA0 interrupt, update the data and select lines and wait for the next clock cycle. This leads to being able to read samples out very fast using interrupt driven DMA or just calculating the next output sample very efficiently.
- Use PC10 to drive the DAC select line
- Pins PC0-PC9 drive the 10 DAC data bits.
- Previously, DAC select was driven from PA1, which is a different port.
- This required extra clock cycles as I had to write to Port C for the data and then update Port A appropriately.
- Since they are sampled by the DAC at the same time, moving DAC select to PC10 streamlines the DAC data loading by only having to write to one port one time. I or Q channels can simply be masked with
PORTC = ( DATA | ( 1 << PC10 )); // I data PORTC = ( DATA & ~( 1 << PC10 )); // Q data
- Correct the footprint for the DC jack so that the power pin isn't shorted directly to GND.
- Connect the LDET pin on the quadrature modulator to a uC input pin.
- Currently driving an LED only.
- Might be nice to know when the quad mod oscillator is locked by giving the signal to the uC so it can check lock status.
- Add an LED to the 3V3 line
- Nice to have a visual indicator that the board is at least getting power
- Because more LED is better.
- Share decoupling caps on pins that are located adjacent to each other
- Saves board space
- Makes layout a bit easier on high pin-density packages
- Make the ST-LINK header a standard 0.1" 6-pin header
- The part I chose came from the DipTrace library that had a Digikey Part number.
- While the part fits the footprint, it's an odd size and hard to make a cable harness to fit it.
- Put the user button on PB1
- If it were left on PB0, it would be hard (impossible?) to tell if an interrupt was triggered by PA0 or PB0 due to the interrupt system on the F405.
- Changing to PB1 puts it on a different interrupt channel allowing for discrimination.
Those are the issues I've discovered up to this point. I haven't finalized the Rev1 schematic yet but when I do I will post the PDF to the project page. This is also why I haven't posted the gerbers to Rev0. I don't want anyone to make a board with several known deficiencies. Look for the schematic in a few days!
- Change the 25MHz TCXO to drive the uC directly.
12/08/2016 at 16:53 •
I've been playing around with the GPSDTx board for a few days now and I've gotten the interface with the DAC sorted out pretty well. It's a pretty simple interface but I didn't implement it quite as efficiently as I could have so that will be something to address in the next board revision.
I still have lots to do to get a more smoothly running product, not the least of which is getting the SysTick turned off. The auto-generated STM32Cube startup code turned that on and it's also included a bunch of extraneous libraries and things that I don't need or want yet depend on the SysTick so, right now, I get glitches every 1mS when updating the DAC due to the SysTick interrupt firing and doing what ever it does.
12/07/2016 at 22:57 •
After a successful soldering, it was on to bringing the board to life.
The first checks were to be sure there were no shorts between nets (especially power and ground) and to make sure all the pins were soldered well. It was during this check that I realized I had soldered all the LEDs in backwards so I had to undo and redo those be hand... Stupid LEDs.
Also, the footprint on my DC jack was wrong and the DC input was connected directly to ground, so that won't be used on this version.
I had verified that everything seemed to be connected only to what it should so took the leap to power it up. I put my power selector jumper on the USB side and plugged the board into a wall wart. No smoke escaped! I checked the power rails and the USB voltage rail was around 5V and the 3.3V linear regulator was making a nice 3.3V. The microcontroller was checked next and it's internal regulator was making a nice 1.2V, as expected.
About this time, I noticed the quadrature modulator chip (ADRF6755) was getting very hot to the touch. I unplugged the power and searched for shorts but couldn't find any. Fortunately, it takes 5V and has it's own internal regulator, and my power plane in the internal layer is 3.3V so I had to run a 5V power trace over to the 6755. I simply cut the trace so I could work on other parts without burning up that one; I'll worry about that later.
Now, I plugged the board into the computer to try and get some code up and running on the microcontroller. I had found some minimal startup code over at this site so I made minor adjustments to make it fit my F405, compiled with GCC, and converted it to DFU file format with ST's Dfu File Manager. I opened up ST's DfuSeDemo, started the board in DFU mode (by holding the BOOT0 button and then pressing the Reset button). It was a great feeling when the board enumerated in the program -- the microcontroller is working!
Unfortunately, that's where I hit the wall and made no progress for quite a while. Nothing was working and I had no idea whether it was bad code or the bootloader process not working correctly so I went into search mode.
As it turns out, the USB bootloader can't run off of the internal oscillator built into the F405, it requires an external clock source between 4 and 26MHz. Bummer. I had planned on the Si5351 giving a 25MHz clock to the uC but I need the uC to be programmed to program the Si5351 to give it a clock... I was basically hosed. So I cut the trace and soldered the red jumper directly from the 25MHz TCXO to the clock in trace and now I had my external clock source for the USB bootloader.
Still nothing worked. I switched gears and instead of using minimal startup code, I went to the STM32 Cube software which generates all the startup code you need and even gives you project files to open the code in various IDEs. I chose TrueStudio (because it has a free trial version) and opened up the code, wrote some more code to make my LEDs blink, and compiled.
About this time, I also noticed that when the board comes up in DFU mode, there are Vendor ID, Product ID, and Version fields that get populated. These fields are also in the DFU file manager program so I made them match, converted my code, and uploaded.
Not holding my breath, I pushed Reset and what do I see? Success!
There's still much more to do but this is a major milestone!
12/07/2016 at 22:01 •
This was my first foray into reflow soldering my SMD parts and also my first time using a stencil for paste application. Wow is that a nice process over hand soldering dozens of 0603 resistors and capacitors and other chips.
The paste application went very smoothly. I used the extra boards taped to the table as a makeshift frame, lined up the stencil and taped it down (on one edge, so the tape acted as a hinge) and then smeared some paste with an old credit card. I ended up having a little too much paste on a few microcontroller pins and on some of the QFN package pins as well and had some solder bridges to clean up, but otherwise it was great. Those bridges can probably be attributed to not enough or uneven pressure during the smear.
Placement was a little rough as I don't have a nice pair of tweezers and instead was using an old and slightly bent pair of forceps, but I got the components place. There were 109 parts and it took me about 45-50 minutes to place them all by hand.
I then pulled out my brand new reflow oven ($30 toaster oven), set the populated board on the rack, and turned it on as high as it would go. It took about 4 minutes before the solder paste melted. After waiting another 20-30 seconds, I turned the toaster off and cracked the door slightly to start it cooling. After about 10 minutes, I had a nice board, and as mentioned above, only had a few solder bridges to deal with.
12/07/2016 at 20:42 •
It was several weeks ago now, but the boards came in from Elecrow fantastic as usual. All told, I put the design on a 10cm x 10cm four-layer board. I had them make a stencil for the solder paste application this time, and that was $16 well spent! It was a steel stencil and made the surface mount components a breeze.
I think the total cost for the boards was around $90.
- $50 for the 10 10cm x 10cm four-layer (I think they actually sent 13!)
- $16 for the stencil
- $24 for the shipping (from submitting my order to getting the boards was 9 days)
Once again, I can't find any fault with the boards from Elecrow and I'd highly recommend them!
11/19/2016 at 16:08 •
The PDF schematic is uploaded into the files section.
So I wanted to create a transmitter that was driven by a decently powerful microcontroller. I chose the STM32F405 because it can run up to 168 MHz and has an on-board FPU. This should enable it to generate the signals itself rather than functioning only as a data pass-through via USB.
The DAC is driven through parallel lines so DMA should be able to be used to drive the data with maximum speed/minimum processor overhead.
I envision that the 25 MHz TCXO will drive the Si5351A clock generator which can, in turn, give a high speed external 25 MHz clock to the microcontroller, drive the clock input of the modulator with a 40 MHz reference, and then feed an additional clock to an interrupt pin on the microcontroller which can then trigger the data and clock of the DAC. The TCXO should give good frequency stability, accuracy, and phase noise characteristics.
The DAC can take up to 20 MSamp/Sec on each I and Q channel. It does some DSP internally where it upsamples and filters the signal but the important thing is that the Nyquist/Reconstruction filters on the DAC outputs should ideally have a 10 MHz cutoff frequency as that is half of the highest sample rate. The filters also do double duty to turn the current outputs into voltages that the quad mod expects. The current is set by the resistor on FDADJ pin of the DAC. It is set to 10 mA max current. The filter converts the differential current outputs to a voltage output with a DC bias of 0.5 V and a differential voltage swing of 1 Vpp. The filter circuit and simulations from LTSpice are shown below (the simulation results are taken from the common node of L1, C4, and R3. ):
The filter outputs go directly into the differential inputs of the quad mod. The quad mod also takes in a reference clock from the Si5351A and the drives an internal PLL and VCO to generate it's local oscillators.
The nominal output power of the ADRF6755 is around 0 dBm. I wanted a little more and also a sacrificial output stage in the event it got ruined by static or abuse of some sort. I chose the GALI-3+ because it is cheap, wide bandwidth, matched to 50 ohms already, can give around 20 dB of gain. 0 dBm on it's input would saturate the amplifier, however, so there is a 10 dB attenuator before the amplifier. Now the output power should be able to go up to 10 dBm and be wideband matched to 50 ohms on both input and output.