Kudos to you.
Looks like you've made some serious progress.
Nice.
I am currently getting a new pcb made in China and they are going to solder the microcontroller and fast external A2D for me. I will do the rest as its still through hole. I will probably go to all SMD at some point.
I just build on the previous version of software for the faster version.
The external A2D is easier than using the one on the microcontroller as its just reading a port as fast as possible and dumping data into RAM. Its then sent out via USB.
Member
Joined 2009
Paid Member
Still waiting for my new usb scope hardware to arrive.
So got my previous version out and started writing code on it for my new hardware.
I was a bit disappointed to find I could only get about 4MHz sampling rate.
After a little help from Microchip forums I managed to get it up to 10MHZ but that looks about the limit for the microcontroller I am using. While it is 200MHz it doesn't run code that fast. It seems to run about a fifth of that speed so I guess it must be about 5 clock cycles per instruction.
I have to clock out data from the a2d so it takes time to clock the I/o pin and then read the i/o port then store the data in a memory buffer.
So got my previous version out and started writing code on it for my new hardware.
I was a bit disappointed to find I could only get about 4MHz sampling rate.
After a little help from Microchip forums I managed to get it up to 10MHZ but that looks about the limit for the microcontroller I am using. While it is 200MHz it doesn't run code that fast. It seems to run about a fifth of that speed so I guess it must be about 5 clock cycles per instruction.
I have to clock out data from the a2d so it takes time to clock the I/o pin and then read the i/o port then store the data in a memory buffer.
Hi Nigel,
It looks like you're going to have to use another A/D converter and use the PIC products for control and maybe features. The PIC could run math functions on the data before displaying it. If you use a small PIc for overall housekeeping and functions & range selections, then the faster PICs for math functions and display you could end up with one heck of a nice 'scope.
-Chris
It looks like you're going to have to use another A/D converter and use the PIC products for control and maybe features. The PIC could run math functions on the data before displaying it. If you use a small PIc for overall housekeeping and functions & range selections, then the faster PICs for math functions and display you could end up with one heck of a nice 'scope.
-Chris
Still waiting for my new usb scope hardware to arrive.
So got my previous version out and started writing code on it for my new hardware.
I was a bit disappointed to find I could only get about 4MHz sampling rate.
After a little help from Microchip forums I managed to get it up to 10MHZ but that looks about the limit for the microcontroller I am using. While it is 200MHz it doesn't run code that fast. It seems to run about a fifth of that speed so I guess it must be about 5 clock cycles per instruction.
I have to clock out data from the a2d so it takes time to clock the I/o pin and then read the i/o port then store the data in a memory buffer.
Most PICs use 4 clock cycles per instruction. Also, this type of high-connectivity chips have programmable clock-wait-cycles in their data I/O operations. Maybe you can change the defaults to run it faster, there's several registers involved.
Never used this one but looked at it some time ago for another project.
Jan
Jan
Last edited:
I have absolutely no experience with these MCUs - but the parallel master port + DMA combination looks like the best performing way of parallel data transfer
e.g. Embedded Engineering : PIC32MX DMA Performance Test , PMP Parallel Master Port DMA Performance (Specifically PIC32MX470F512H) 10MHz x 32bit rate with 120MHz MCU.
I have no idea if that is practically viable for the transfer from the ADC.
e.g. Embedded Engineering : PIC32MX DMA Performance Test , PMP Parallel Master Port DMA Performance (Specifically PIC32MX470F512H) 10MHz x 32bit rate with 120MHz MCU.
I have no idea if that is practically viable for the transfer from the ADC.
Designing a partly SMD pcb for my latest version threw up a shortcoming in my pcbcad software. The PIC TQFP package and AD9200 A2D SSOP package are both "off grid".
So when I try to connect the tracks to the pins I have to do it free hand which is inaccurate. The pcb was looking terrible by the time I got loads of tracks in.
The tracks to the chip pins were often a little skewed.
So I got stuck into the software and came up with a couple of new functions.
The first function using Control - B key produces a new track segment which lines up backwards to the component pin it came from.
The second function Control - R key produces a right angle from current track position to the next pin to connect to. Both are controlled by current mouse pointer position so you get a choice of which way the tracks goes.
The tracks are now all spot on and look much more professional.
So when I try to connect the tracks to the pins I have to do it free hand which is inaccurate. The pcb was looking terrible by the time I got loads of tracks in.
The tracks to the chip pins were often a little skewed.
So I got stuck into the software and came up with a couple of new functions.
The first function using Control - B key produces a new track segment which lines up backwards to the component pin it came from.
The second function Control - R key produces a right angle from current track position to the next pin to connect to. Both are controlled by current mouse pointer position so you get a choice of which way the tracks goes.
The tracks are now all spot on and look much more professional.
HI Nigel,
At least you figured out how to correct that issue!
-Chris
Its just the fine pitched SMD that cause a problem.
It tends to be metric so doesn't fit in with the factors of 100 thou of an inch grid.
Got my new pcb through today.
PIC programmed ok but wouldn't run.
Noticed crystal was a bit too far away from the PIC so soldered it close and it started oscillating fine.
Then USB wouldn't run. Had a look at my previous circuit and noticed I missed the 100nf off USB3V3 pin. I soldered cap on and USB started working.
The output on the pc was terrible with big steps in the sine wave and loads of noise.
I eventually tracked it down to MPLAB Harmony pin setting screen. While I had set port b as GPIO_IN I had missed setting a couple of pins to tristate inputs.
The scope runs really well at about 10 mega samples per second.
The pcb needs quite a bit of rework but thats all part of development.
Important lessons learned so that is valuable.
The next pcb threw up a couple of shortcomings in my CAD software.
1/ Via sizes aren't remembered so you have to set them all individually. I now save the via sizes and use them if a new track segment is added.
2/ Going through pcb setting each individual via sizes was tedious so added a blockmode function to set via sizes in a block.
PIC programmed ok but wouldn't run.
Noticed crystal was a bit too far away from the PIC so soldered it close and it started oscillating fine.
Then USB wouldn't run. Had a look at my previous circuit and noticed I missed the 100nf off USB3V3 pin. I soldered cap on and USB started working.
The output on the pc was terrible with big steps in the sine wave and loads of noise.
I eventually tracked it down to MPLAB Harmony pin setting screen. While I had set port b as GPIO_IN I had missed setting a couple of pins to tristate inputs.
The scope runs really well at about 10 mega samples per second.
The pcb needs quite a bit of rework but thats all part of development.
Important lessons learned so that is valuable.
The next pcb threw up a couple of shortcomings in my CAD software.
1/ Via sizes aren't remembered so you have to set them all individually. I now save the via sizes and use them if a new track segment is added.
2/ Going through pcb setting each individual via sizes was tedious so added a blockmode function to set via sizes in a block.
Last edited:
What kind of PCB software are you using? While I used to use EAGLE I have completely switched to KiCad v5 now.
As of the USB MCU, is there any reason behind the choice of PIC32? For such a project I personally would prefer something much faster like STM32F405 for its 168MHz operation and USB 2.0 High Speed interface. STM32 also uses ARM cores which has excellent open source support in GCC, CMSIS-DAP, OpenOCD and GDB.
As of the USB MCU, is there any reason behind the choice of PIC32? For such a project I personally would prefer something much faster like STM32F405 for its 168MHz operation and USB 2.0 High Speed interface. STM32 also uses ARM cores which has excellent open source support in GCC, CMSIS-DAP, OpenOCD and GDB.
What kind of PCB software are you using? While I used to use EAGLE I have completely switched to KiCad v5 now.
As of the USB MCU, is there any reason behind the choice of PIC32? For such a project I personally would prefer something much faster like STM32F405 for its 168MHz operation and USB 2.0 High Speed interface. STM32 also uses ARM cores which has excellent open source support in GCC, CMSIS-DAP, OpenOCD and GDB.
The PIC32mz runs at 200MHz internally. The fastest it can grab port data is about 10MHz. It also uses USB 2.0 but I just use HID as its fast enough.
This is the prototype pcb.
A couple of caps glued on for extra decoupling.
Crystal moved about an inch to be next to PIC.
Bottom right hand side IC and components was a clock for A2D but I decided to clock it from the PIC so I could synch better.
A couple of caps glued on for extra decoupling.
Crystal moved about an inch to be next to PIC.
Bottom right hand side IC and components was a clock for A2D but I decided to clock it from the PIC so I could synch better.
An externally hosted image should be here but it was not working when we last tested it.
While STM32 has a slower internal clock it can access digital I/O at 84MHz. The STM32F4 line also comes with hardware FPU for onboard signal preprocessing. Even the much slower STM32F0 series has 24MHz digital I/O. If you want fast, there is STM32F7 series with 216MHz Cortex-M7 cores, built-in USB 2.0 high speed transceivers (STM32F4 required external USB3300 transceivers for USB 2.0 480Mb/s operation) and 108MHz I/OThe PIC32mz runs at 200MHz internally. The fastest it can grab port data is about 10MHz. It also uses USB 2.0 but I just use HID as its fast enough.
As of the PCB, I think with signals at that speed you will need the board be implemented using as much surface mount parts as possible.
Also you can run the PIC on the same clock as the external ADC. This can eliminate your clock woes. On the other hand you can also run the ADC on the clock derived from the PIC.
As of USB interface, USB audio class can be a better option than USB HID as it allows a much higher throughput.
Last edited:
- Home
- Design & Build
- Equipment & Tools
- PC USB scope project.