mmahdim/STM32F4-Scope

How to build in CubeIDE?

dizcza opened this issue · 15 comments

First of all, thanks for making the project available.
I uploaded a binary file and it worked on my Disco board. Finally, I have a cheap instrument to inspect I2C packets.

I have a few questions:

  1. What do these regimes mean: A, N, and S? The upper right button.
  2. I cannot import your project as an existing project in CubeIDE. You have a non-default arrangement of directories, and the config files (.cproject, .project, .mxproject) are missing. When I opened the ioc file in CubeMX and regenerated from scratch, a lot of file includes issues appear.

I'd like to work on your project but it seems the onboarding is tough so far.

Things I wanted to add:

  • Vmax and Vmin amplitudes
  • signal width triggering (glitches)
  • signal amplitude triggering (glitches)
  • a sort of self-test accuracy test to show how genuine the results are
  • ability to trigger on specific GPIO goes high (this doesn't relate to a typical oscilloscope but becomes handy inspecting which traces led to errors on an end-user app)

You're welcome :)
it's great to hear that it's useful!

  1. A stands for Auto mode, N for Normal mode, and S for Single shot mode. If you see the demo video you will get an idea.
    "In auto trigger mode, the trigger will be forced if the specified conditions are not met. In normal trigger mode, the trigger will never be forced and a trigger will only occur if the specified conditions are met." source: Keysight
    And the single mode is just like normal, except that it triggers only once until you press the blue button again.

  2. I created the project from TouchGFX. Therefore, the arrangement is a bit different. I think if you open the .project file from STM32CubeIDE/ it should load properly.

If you could implement your mentioned options, that would be great!

My original idea was to make a shield-like board (like Arduino's) for students, etc. who already have the discovery board but don't have an oscilloscope, to turn their discovery board into one.

It still needs an analog frontend, but it's not that hard to design. I didn't have the time to complete the analog section, but if I see it getting attention, I will put some effort into it.

So I managed to re-generate the project in TouchGFX 4.17.0 and opened it in CubeIDE 1.10.1. But when I click Build I get

13:37:16 **** Build of configuration Debug for project STM32F429I-Oscilloscope ****
make -j4 all 
Application/User/subdir.mk:42: *** target pattern contains no '%'.  Stop.
"make -j4 all" terminated with exit code 2. Build might be incomplete.

I googled what this undescriptive error means and found no solution that would suit me.


It still needs an analog frontend

Do you mean to improve oscilloscope characteristics?

Hi Dizcza!
I've just successfully imported the project into my CubeIDE 1.9.0 and built it.
I can give you a recipe that you can test on your PC.
After you open the CubeIDE, choose an arbitrary workspace then close the information tab.
Now, you can see the "import projects ..." link on the left panel. Click on it and choose "General -> Existing Projects ...".
On the next page, click Browse in the "Select root directory:" part and choose the "STM32-Scope-Main" directory.
Finally, you can build the project.
If you have some issues please tell us.

Best regards,
Sajjad

Do you mean to improve oscilloscope characteristics?

The sample rate is defined by the microcontroller's ADC and cannot be changed by the analog frontend.
But currently, the input range of the oscilloscope is limited to 0-3.3v, and voltages above or below that can fry the microcontroller. Therefore, we would need to add some opamps for amplification/attenuation of the input signal. Above that, features like voltage offset would also need to be implemented in the analog domain.
But the most serious issue right now is that the trigger EXTI pin is currently connected to the input signal. therefore there's no control over when the trigger happens. i.e. the trigger level is currently defined by the microcontroller's digital input threshold which is not a good idea. In order to solve this issue, one must use a comparator to compare the input signal with a predefined value and generate the trigger signal.

So basically the analog frontend would need a few opamps in order to amplify/attenuate the input signal, and also add the voltage offset; And also a comparator to generate the trigger signal.

After you open the CubeIDE, choose an arbitrary workspace then close the information tab. Now, you can see the "import projects ..." link on the left panel. Click on it and choose "General -> Existing Projects ...". On the next page, click Browse in the "Select root directory:" part and choose the "STM32-Scope-Main" directory. Finally, you can build the project. If you have some issues please tell us.

That's exactly what I did. I did choose the root directory.

Screenshot from 2022-10-31 18-29-31

I'm on Ubuntu 22.04. Maybe that's the reason.

Do you mean to improve oscilloscope characteristics?

The sample rate is defined by the microcontroller's ADC and cannot be changed by the analog frontend. But currently, the input range of the oscilloscope is limited to 0-3.3v, and voltages above or below that can fry the microcontroller. Therefore, we would need to add some opamps for amplification/attenuation of the input signal. Above that, features like voltage offset would also need to be implemented in the analog domain. But the most serious issue right now is that the trigger EXTI pin is currently connected to the input signal. therefore there's no control over when the trigger happens. i.e. the trigger level is currently defined by the microcontroller's digital input threshold which is not a good idea. In order to solve this issue, one must use a comparator to compare the input signal with a predefined value and generate the trigger signal.

So basically the analog frontend would need a few opamps in order to amplify/attenuate the input signal, and also add the voltage offset; And also a comparator to generate the trigger signal.

I see. So you want to build an expansion board smth like this https://github.com/pondahai/oscilloscopen/tree/master/hardware but for Disco boards. It's a good idea to add an optional analog frontend but if you make it complicated like in the link I'm posting, the students/users might recoil from using it.

For example, if you design a dedicated PCB, I will probably not use it since it will require buying it on (the best case) aliexpress and waiting >1 month for delivery. In this case, I'd better search for dedicated DIY oscilloscopes on aliexpress. But if you provide a how-to-do list to build an analog frontend from already available components (I imagine every radio amateur has something at his disk for use) and that could be soldered in less than 3 hours on a breadboard, I'd be happy to follow such a guideline.

Anyway, I imagine this is your pet project. If I manage to set it up locally, I may play around with functionality and see how it goes in my leisure time.

Do you mean to improve oscilloscope characteristics?

The sample rate is defined by the microcontroller's ADC and cannot be changed by the analog frontend. But currently, the input range of the oscilloscope is limited to 0-3.3v, and voltages above or below that can fry the microcontroller. Therefore, we would need to add some opamps for amplification/attenuation of the input signal. Above that, features like voltage offset would also need to be implemented in the analog domain. But the most serious issue right now is that the trigger EXTI pin is currently connected to the input signal. therefore there's no control over when the trigger happens. i.e. the trigger level is currently defined by the microcontroller's digital input threshold which is not a good idea. In order to solve this issue, one must use a comparator to compare the input signal with a predefined value and generate the trigger signal.
So basically the analog frontend would need a few opamps in order to amplify/attenuate the input signal, and also add the voltage offset; And also a comparator to generate the trigger signal.

I see. So you want to build an expansion board smth like this https://github.com/pondahai/oscilloscopen/tree/master/hardware but for Disco boards. It's a good idea to add an optional analog frontend but if you make it complicated like in the link I'm posting, the students/users might recoil from using it.

For example, if you design a dedicated PCB, I will probably not use it since it will require buying it on (the best case) aliexpress and waiting >1 month for delivery. In this case, I'd better search for dedicated DIY oscilloscopes on aliexpress. But if you provide a how-to-do list to build an analog frontend from already available components (I imagine every radio amateur has something at his disk for use) and that could be soldered in less than 3 hours on a breadboard, I'd be happy to follow such a guideline.

Yeah, my original plan was to make the analog part as simple as possible. e.g. a single-sided custom PCB that can be ordered for cheap and soldered as a DIY project.
I even designed and simulated the analog part in LTspice and bought some of the parts to make a prototype but then I started my master's and now I'm too busy for that :(
Also, a big advantage of this project is its high sample rate. For instance, the $40 DSO112a from Aliexpress has a sample rate of 5Msps, while this one has 7.2Msps and the extension board can be probably made for <$10 if the user already has the discovery board.
Anyways, I hope that you can get it running.

Yeah, my original plan was to make the analog part as simple as possible. e.g. a single-sided custom PCB that can be ordered for cheap and soldered as a DIY project.
I even designed and simulated the analog part in LTspice and bought some of the parts to make a prototype but then I started my master's and now I'm too busy for that :(

Well, this sounds like the proper theme of a master's project. Perhaps you could spare some time by delegating the ideas you have to other students at your institute ;)

Ah, really waiting for your analog parts extension. I've bought Adalm1000 but it comes with only the 250 kSPS rate limited by AD7682 ADC. Interestingly, the price for M1K is similar to F429 Disco.
They also have the M2K version but it's beyond my budget.

Ah, really waiting for your analog parts extension. I've bought Adalm1000 but it comes with only the 250 kSPS rate limited by AD7682 ADC. Interestingly, the price for M1K is similar to F429 Disco. They also have the M2K version but it's beyond my budget.

Hi Danylo,

Did you manage to import the project into CubeIDE?
I don't think I will be able to finish the analog part soon, especially since things in my country are not going very well, and therefore I and almost everyone I know are trying to build up a resume to apply for a university/job abroad.
I might upload a sketch of the analog part that I was working on, but it's unfinished and still needs some work.

Did you manage to import the project into CubeIDE?

No, I gave up :) I might return to this when I learn the basics of TouchGFX code generation - I haven't used it so far.

I might upload a sketch of the analog part that I was working on, but it's unfinished and still needs some work.

I'd be much obliged if you share the schematics, even if it's unfinished. My email is dizcza at gmail.com

I'd be much obliged if you share the schematics, even if it's unfinished. My email is dizcza at gmail.com

I just added the schematic that I was working on in LTspice. It's named "Draft1.asc".
Also added some descriptions of the analog schematic.
Sorry for the delay, I'm quite busy writing a resume for my application for a summer student program right now.
I hope it can help.

I was particularly interested in which op-apms you intended to use, and how you calculate the capacitance of a capacitor for different parts.
Thanks. I'll have a look at the original scope you mention in readme.

Ah, I bought a cheap digital scope for $100 - not a big difference in price w.r.t. STM32F4-Disco boards and yet much broader functional.
Still, I liked your project.