Open ShaviTF opened 2 years ago
Hi You have done the hard part That problem is usually the sign of a problem when saving stuff to the flash 1- What is the complete reference of the MCU ? Would it be a CH32F103 by any chance ? 2- Which binary did you use / how did you build it if you built it from source ?
Hello... first of all, thank you for the work you are doing and for taking the trouble to help us...
1. About the MCU is the STM32F103C8T6. I have been researching and I have seen that this one comes with 64 and with 128K. I am using STM's "Flash loader Demonstrator" to program it, and when I plug it in it saids me that it's the 128k version .
2. I have tried the FNIRSI binary (without bootloader) flashing to 64k (in this case it boots but the ok button doesn't work) and the JYTECH binary (with bootloader) flashing to 128k... (The application doesn't give me any errors and after writing it verifies correctly, which makes me assume that it's really the MCU is 128k), but in this case it is where the calibration hangs.
I have not tried to compile the software myself, basically because I have never done it, but I will try to investigate how to do it
1- Ok, assuming it's a guenuine STMF103CxT6 it should have 128 kB (but claiming it has only 64 kB) The "Flash loader Demonstrator" is using serial or swd ? There was report that if it using serial, you should make sure the watchdog is disabled and try to flash it twice, it may help (dont ask why)
2- Ok that behaviour shows it is not a CH32 style motherboard
If you can, try flashing the code using a stlinkv2 + openOCD or something similar, it should work
I am using UART, I don't have SWD programmer. I have tried programming several times and there is no difference. I've also tried disabling WatchDog (WDG_SW) with the "Flash Loader Demonstrator", but doing so only gives me a blank screen at boot. It's weird... I can get into DFU, and everything seems ok until it gets to calibration... then it hangs with the message "-processing-"
Could you try the attached binary ? It skips calibration check, so you'll have garbage on screen but to check everything else works [](url lnDSO_nocal.zip
If it fails at the first calibration step (i.e. AC or DC) and not a the end, it's not the flash but rather the ADC If the test binary works for you, you can try manually doing a calibration Long press the rotary encoder to enter menu then Calibration -> wipe calibration reboot Calibration -> Basic calibrate
Ok... now finaly i could got into the application, but, although it does record data, the graph is not shown, that is, I can enter the menus and if I change the "Test signal" menu values (amplitude and frequency), these are reflected in the values detected by de probe in the left column, but the graph is not displayed on the main screen.
About calibration still not working. That is, I can do the "wipe calibration", but after reboot, when I hit basic calibration, it hangs at the same point as before (although now it doesn't show the sentence -processing-)
Ok so in "normal" mode the ADC is working The display is gibberish because without calibration the values are out of scale Can you get the serial output when you do calibration ? (115200 / 8 bits/ no hw flow control / no parity)
Ok...
The only read i get is: Adc : Asked for fq=1000 got fq=1000 intDiv:1 int Frac=6464
And then it hangs immediately
If you are willing to help me, i can try to find out what's going wrong by providing test firmwares, will probably take a few steps
No problem. For sure i will help you... in the real you are helping me :D
Does this work ?, it will go to calibration at start (Trying to pindown the issue) nocal_mark2.zip
Now as you say goes to calibration at start, but hangs at "-processing-" again.
Terminal output is similar: Adc : Asked for fq=1000 got fq=1000 intDiv:1 intFrac=6464 Setting new GainRange=0
Next : This is the expected output Setting new GainRange=0 Starting ADC... Ending ADC... Range : 0 val=2062
My guess is you will only have Starting ADC... cal3.zip
New output: Adc : Asked for fq=1000 got fq=1000 intDiv:1 intFrac=6464 Setting new GainRange=0 Starting ADC...
keeps hanging on -processing-
Another one to test, i'm not expecting it to work but i fixed a bug, mayb....
A couple of questions :
Ok...sorry for the late response...I was out all day... It seems that now there is more information. I enclose the complete trace since the equipment starts.
Regarding whether the changes made to the AC/DC switch are reflected, yes, they are reflected. Before the calibration, it tells me in which position it is requiring me to position it in DC in order to proceed with the calibration.
I can also confirm that quartz is 8 Mhz
Hope this can help you
Setuping up DSO... 0: R=18 overSampling=0 1: R=36 overSampling=0 2: R=90 overSampling=0 3: R=180 overSampling=0 4: R=360 overSampling=0 5: R=900 overSampling=0 6: R=1800 overSampling=0 7: R=3600 overSampling=0 8: R=9000 overSampling=0 9: R=18000 overSampling=0 10: R=36000 overSampling=0 11: R=90000 overSampling=0 Starting sanity Check Check ok read Offset =0x4 Starting DSO... Setting new GainRange=7 Adc : Asked for fq=20000 got fq=20000 intDiv:0 intFrac=3600 New timebase=6 : 1ms, fq=20000 Cannot read invert setting Loading calibration data Cannot load AC calibration Adc : Asked for fq=1000 got fq=1000 intDiv:1 intFrac=6464 Setting new GainRange=0 Starting ADC... Ending ADC... Range : 0 val=2077 Setting new GainRange=1 Starting ADC...
after that, it keeps hanging on "-processing-"
That one may work nocal5.zip
I think we've taken a step backwards... The new output:
Setuping up DSO... 0: R=18 overSampling=0 1: R=36 overSampling=0 2: R=90 overSampling=0 3: R=180 overSampling=0 4: R=360 overSampling=0 5: R=900 overSampling=0 6: R=1800 overSampling=0 7: R=3600 overSampling=0 8: R=9000 overSampling=0 9: R=18000 overSampling=0 10: R=36000 overSampling=0 11: R=90000 overSampling=0 Starting sanity Check Check ok read Offset =0x4 Starting DSO... Setting new GainRange=7 Adc : Asked for fq=20000 got fq=20000 intDiv:0 intFrac=3600 New timebase=6 : 1ms, fq=20000 Cannot read invert setting Loading calibration data Cannot load AC calibration Adc : Asked for fq=1000 got fq=1000 intDiv:1 intFrac=6464 Setting new GainRange=0 Starting ADC...
With the previous firmware we got to GainRange=1... but with this one we are again stuck at GainRange=0
I programmed it several times, even doing a full wipe and reinstalling the bootloader just in case... but there were no differences... except for the "sanity check" part.
On the first boot after full wipe, in that "section" the message is different ... 11: R=90000 overSampling=0 No valid sector found, reformatting Nvm not operational, reformatting... Starting DSO... ... I understand that it is normal for the first start. When restarting it already starts with the sequence that I put above
Would it be possible for you to get a st linkv 2 clone and upload that way ? ( a clone is ~ 2$ or so)
I tried with DSO based on CH32/STM32/GD32 with all the versions i provided, they all work fine. The only difference is the way you flash it so far
If you happen to have a bluepill board, you can put the blackmagic software on it temporarily to flash the DSO
Hi, I have the exact same issue, I flashing with blackmagic (using blackmagic-bluepill).
Hanging at DC Calibration
Flashed with: bootloader_2.2.elf lnDSO_JYETECH_2.2.elf
~The only issue that I have is that it seams that the erase does not work: After erase, the DSO boot normally to the calibration screen.~
Update: erase work with the gbd command monitor erase_mass
, reboot to a white screen.
Re flashing and the same issue is here, still hanging at DC calibration.
That one may work nocal5.zip
@mean00 Can you upload the elf of this, so I can test it.
Please find cal6 attached, should be similar to cal5 When it is stuck, it would be interesting to see if it crashed i.e. the output of the 'bt' command cal6.zip
It seam to be a FNIRSI but with STM32 F103C8T6: (Ordered in 2021)
I have tried before with the FNIRSI efi but the Ok button seam to no not work.
I'm trying the cal6.
The main diff between FNIRSI and non FNIRSI :
So if the fw can detect the AC/DC/GND switch position, you have the correct fw for that board
Serial logs:
Setuping up DSO...
0: R=18 overSampling=0
1: R=36 overSampling=0
2: R=90 overSampling=0
3: R=180 overSampling=0
4: R=360 overSampling=0
5: R=900 overSampling=0
6: R=1800 overSampling=0
7: R=3600 overSampling=0
8: R=9000 overSampling=0
9: R=18000 overSampling=0
10: R=36000 overSampling=0
11: R=90000 overSampling=0
Starting sanity Check
Check ok
read Offset =0x4
Starting DSO...
Setting new GainRange=7
Adc : Asked for fq=20000 got fq=20000
intDiv:0 intFrac=3600
New timebase=6 : 1ms, fq=20000
Cannot read invert setting
Loading calibration data
Cannot load AC calibration
Adc : Asked for fq=1000 got fq=1000
intDiv:1 intFrac=6464
Setting new GainRange=0
Starting ADC...
gdb :
(gdb) target extended-remote COM4
Remote debugging using COM4
(gdb) mon swdp_scan
Target voltage: 3.26V
Available Targets:
No. Att Driver
1 STM32F1 (clone) medium density M3
(gdb) attach 1
Attaching to Remote target
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0x08004e92 in ?? ()
(gdb) bt
#0 0x08004e92 in ?? ()
#1 0x08005668 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) file cal6.elf
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from cal6.elf...
(gdb) bt
#0 0x08004e92 in prvCheckTasksWaitingTermination () at /home/fx/Arduino_gd32/lnDSO150/lnArduino/FreeRTOS/tasks.c:3697
#1 prvIdleTask (pvParameters=<optimized out>) at /home/fx/Arduino_gd32/lnDSO150/lnArduino/FreeRTOS/tasks.c:3447
#2 0x08005f1c in prvPortStartFirstTask () at /home/fx/Arduino_gd32/lnDSO150/lnArduino/FreeRTOS/portable/GCC/ARM_CM3/port.c:242
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
I'm no familiar with gdb, so if I have done anything in the wrong way, please tell me
No, it's good :) It did not crash, it's just waiting for the ADC to say "done".
If you are ok with it, I'll create a few test programs to narrow down why the ADC is not working as expected
Could you try running the code i.e. mon swdp_scan attach 1 file cal6.elf r <== that line
it should reset then start
It look like there is no crash, the program just start and hang:
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: C:\Users\seb65\Documents\DSO\cal6.elf
But, i think the is more logs ?
Setuping up DSO...
0: R=18 overSampling=0
1: R=36 overSampling=0
2: R=90 overSampling=0
3: R=180 overSampling=0
4: R=360 overSampling=0
5: R=900 overSampling=0
6: R=1800 overSampling=0
7: R=3600 overSampling=0
8: R=9000 overSampling=0
9: R=18000 overSampling=0
10: R=36000 overSampling=0
11: R=90000 overSampling=0
Starting sanity Check
Check ok
read Offset =0x4
Starting DSO...
Setting new GainRange=7
Adc : Asked for fq=20000 got fq=20000
intDiv:0 intFrac=3600
New timebase=6 : 1ms, fq=20000
Cannot read invert setting
Loading calibration data
Cannot load AC calibration
Adc : Asked for fq=1000 got fq=1000
intDiv:1 intFrac=6464
Setting new GainRange=0
Starting ADC...
Ending ADC...
Range : 0 val=2123
Setting new GainRange=1
Starting ADC...
Ending ADC...
Range : 1 val=2173
Setting new GainRange=2
Starting ADC...
Hanging at GainRange=2 but before was GainRange=0
Still nothing:
Setuping up DSO...
0: R=18 overSampling=0
1: R=36 overSampling=0
2: R=90 overSampling=0
3: R=180 overSampling=0
4: R=360 overSampling=0
5: R=900 overSampling=0
6: R=1800 overSampling=0
7: R=3600 overSampling=0
8: R=9000 overSampling=0
9: R=18000 overSampling=0
10: R=36000 overSampling=0
11: R=90000 overSampling=0
Starting sanity Check
Check ok
read Offset =0x4
Starting DSO...
Setting new GainRange=7
Adc : Asked for fq=20000 got fq=20000
intDiv:0 intFrac=3600
New timebase=6 : 1ms, fq=20000
Cannot read invert setting
Loading calibration data
Cannot load AC calibration
Adc : Asked for fq=1000 got fq=1000
intDiv:1 intFrac=6464
Setting new GainRange=0
Starting ADC...
PS: I see that you are french, if you want we can have a visio call to make more advanced debugging
I'm building a new version that uses a different calibration method. Ready in ~ 15mn ps : Bien noté :)
Ok interesting, I have made some debugging:
(gdb) break averageADCRead
Breakpoint 3 at 0x80088c6: file /home/fx/Arduino_gd32/lnDSO150/src/dso_calibrate.cpp, line 223.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: C:\Users\seb65\Documents\DSO\cal7.elf
Breakpoint 2, waitForCoupling (target=DSOControl::DSO_COUPLING_DC) at /home/fx/Arduino_gd32/lnDSO150/src/dso_calibrate.cpp:176
176 /home/fx/Arduino_gd32/lnDSO150/src/dso_calibrate.cpp: No such file or directory.
(gdb) continue
Continuing.
Breakpoint 3, 0x080088c6 in averageADCRead () at /home/fx/Arduino_gd32/lnDSO150/src/dso_calibrate.cpp:223
223 in /home/fx/Arduino_gd32/lnDSO150/src/dso_calibrate.cpp
(gdb) next
doCalibrate (array=<optimized out>, color=color@entry=2047, txt=txt@entry=0x8012c48 "", target=target@entry=DSOControl::DSO_COUPLING_DC) at /home/fx/Arduino_gd32/lnDSO150/src/dso_calibrate.cpp:247
247 in /home/fx/Arduino_gd32/lnDSO150/src/dso_calibrate.cpp
(gdb) next
248 in /home/fx/Arduino_gd32/lnDSO150/src/dso_calibrate.cpp
(gdb) next
249 in /home/fx/Arduino_gd32/lnDSO150/src/dso_calibrate.cpp
(gdb) next
The last reponsive line seams to be 249 in dso_calibrate.cpp
Ahhh, we are going forward: DC is ok, but now blocked at AC calibration
Setuping up DSO...
0: R=18 overSampling=0
1: R=36 overSampling=0
2: R=90 overSampling=0
3: R=180 overSampling=0
4: R=360 overSampling=0
5: R=900 overSampling=0
6: R=1800 overSampling=0
7: R=3600 overSampling=0
8: R=9000 overSampling=0
9: R=18000 overSampling=0
10: R=36000 overSampling=0
11: R=90000 overSampling=0
Starting sanity Check
Check ok
read Offset =0x4
Starting DSO...
Setting new GainRange=7
Adc : Asked for fq=20000 got fq=20000
intDiv:0 intFrac=3600
New timebase=6 : 1ms, fq=20000
Cannot read invert setting
Loading calibration data
Cannot load AC calibration
Setting new GainRange=0
Starting ADC...
Ending ADC...
Range : 0 val=2122
Setting new GainRange=1
Starting ADC...
Ending ADC...
Range : 1 val=2178
Setting new GainRange=2
Starting ADC...
Ending ADC...
Range : 2 val=2150
Setting new GainRange=3
Starting ADC...
Ending ADC...
Range : 3 val=2137
Setting new GainRange=4
Starting ADC...
Ending ADC...
Range : 4 val=2128
Setting new GainRange=5
Starting ADC...
Ending ADC...
Range : 5 val=2125
Setting new GainRange=6
Starting ADC...
Ending ADC...
Range : 6 val=2123
Setting new GainRange=7
Starting ADC...
Ending ADC...
Range : 7 val=2161
Setting new GainRange=8
Starting ADC...
Ending ADC...
Range : 8 val=2142
Setting new GainRange=9
Starting ADC...
Ending ADC...
Range : 9 val=2132
Setting new GainRange=10
Starting ADC...
Ending ADC...
Range : 10 val=2126
Setting new GainRange=0
Starting ADC...
Ending ADC...
Range : 0 val=2122
Setting new GainRange=1
Starting ADC...
Ending ADC...
Range : 1 val=2183
Setting new GainRange=2
Starting ADC...
Ending ADC...
Range : 2 val=2154
Setting new GainRange=3
Starting ADC...
Ending ADC...
Range : 3 val=2139
Setting new GainRange=4
Starting ADC...
Ending ADC...
Range : 4 val=2129
Setting new GainRange=5
Starting ADC...
Ending ADC...
Range : 5 val=2125
Setting new GainRange=6
Starting ADC...
Ending ADC...
Range : 6 val=2124
Setting new GainRange=7
Starting ADC...
Ending ADC...
Range : 7 val=2162
Setting new GainRange=8
Starting ADC...
Ending ADC...
Range : 8 val=2142
Setting new GainRange=9
Starting ADC...
Ending ADC...
Range : 9 val=2132
Setting new GainRange=10
Starting ADC...
Ending ADC...
Range : 10 val=2126
ok, that's normal Next coming
is it stuck in
?
Nop, but not far:
(gdb) continue
Continuing.
Program received signal SIGINT, Interrupt.
lnDelayUs (wait=wait@entry=100) at /home/fx/Arduino_gd32/lnDSO150/lnArduino/src/systemHelper.cpp:98
98 /home/fx/Arduino_gd32/lnDSO150/lnArduino/src/systemHelper.cpp: No such file or directory.
ok, it is stuck writing in the flash, smells of stack smashing I'll look into it tomorrow
Thanks!
Calibration seams to work:
Setuping up DSO...
0: R=18 overSampling=0
1: R=36 overSampling=0
2: R=90 overSampling=0
3: R=180 overSampling=0
4: R=360 overSampling=0
5: R=900 overSampling=0
6: R=1800 overSampling=0
7: R=3600 overSampling=0
8: R=9000 overSampling=0
9: R=18000 overSampling=0
10: R=36000 overSampling=0
11: R=90000 overSampling=0
Starting sanity Check
Check ok
read Offset =0x6a
Starting DSO...
Setting new GainRange=7
Adc : Asked for fq=20000 got fq=20000
intDiv:0 intFrac=3600
New timebase=6 : 1ms, fq=20000
Loading calibration data
Inconistent size
Cannot load AC calibration
Setting new GainRange=0
Starting ADC...
Ending ADC...
Range : 0 val=2126
Setting new GainRange=1
Starting ADC...
Ending ADC...
Range : 1 val=2142
Setting new GainRange=2
Starting ADC...
Ending ADC...
Range : 2 val=2132
Setting new GainRange=3
Starting ADC...
Ending ADC...
Range : 3 val=2132
Setting new GainRange=4
Starting ADC...
Ending ADC...
Range : 4 val=2162
Setting new GainRange=5
Starting ADC...
Ending ADC...
Range : 5 val=2142
Setting new GainRange=6
Starting ADC...
Ending ADC...
Range : 6 val=2124
Setting new GainRange=7
Starting ADC...
Ending ADC...
Range : 7 val=0
Setting new GainRange=8
Starting ADC...
Ending ADC...
Range : 8 val=2123
Setting new GainRange=9
Starting ADC...
Ending ADC...
Range : 9 val=2123
Setting new GainRange=10
Starting ADC...
Ending ADC...
Range : 10 val=2126
Setting new GainRange=0
Starting ADC...
Ending ADC...
Range : 0 val=2126
Setting new GainRange=1
Starting ADC...
Ending ADC...
Range : 1 val=2142
Setting new GainRange=2
Starting ADC...
Ending ADC...
Range : 2 val=2132
Setting new GainRange=3
Starting ADC...
Ending ADC...
Range : 3 val=2132
Setting new GainRange=4
Starting ADC...
Ending ADC...
Range : 4 val=2162
Setting new GainRange=5
Starting ADC...
Ending ADC...
Range : 5 val=2142
Setting new GainRange=6
Starting ADC...
Ending ADC...
Range : 6 val=2124
Setting new GainRange=7
Starting ADC...
Ending ADC...
Range : 7 val=0
Setting new GainRange=8
Starting ADC...
Ending ADC...
Range : 8 val=2123
Setting new GainRange=9
Starting ADC...
Ending ADC...
Range : 9 val=2123
Setting new GainRange=10
Starting ADC...
Ending ADC...
Range : 10 val=2126
OK
OK
After restart, i seen the main page, but no line or data:
Here is the logs:
Setuping up DSO...
0: R=18 overSampling=0
1: R=36 overSampling=0
2: R=90 overSampling=0
3: R=180 overSampling=0
4: R=360 overSampling=0
5: R=900 overSampling=0
6: R=1800 overSampling=0
7: R=3600 overSampling=0
8: R=9000 overSampling=0
9: R=18000 overSampling=0
10: R=36000 overSampling=0
11: R=90000 overSampling=0
Starting sanity Check
Check ok
read Offset =0x4c
Starting DSO...
Setting new GainRange=7
Adc : Asked for fq=20000 got fq=20000
intDiv:0 intFrac=3600
New timebase=6 : 1ms, fq=20000
Cannot read invert setting
Loading calibration data
VolMenu : redraw 0
time redraw : redraw 0
voltTrigger_redraw : redraw 0
stat redraw : redraw 0
voltTriggerValue_redraw : redraw 0
*
*
*
...
and if you connect the probe to the signal generator you see squares ?
Nope, still nothing
Try long press on V/DIV
Hanging like for calibration:
Event:1 , key:3
Adc : Asked for fq=20000 got fq=20000
intDiv:0 intFrac=3600
New timebase=6 : 1ms, fq=20000
Setting new GainRange=9
Ok interesting, i have manged to have something but only at 20ms, other time range don't work (red rectangle on top right and no refresh), and the voltage seams wrong (I have checked the probe and it's in 1x mode) :
interesting It means using the 20ms frequency to calibrate should work All the used resources are internal to the MCU : ADC / DMA / Timer So either :
There was issues like that with the GD32. They were bugs that didnt cause problem on the STM32 but didnt work with the GD32.
The MCU is a STM32F103C8T6, and after looking for the documentation, it look like i have only 64k of flash, can this be related ? (C 8 T 6 ==> 8 = 64 Kbytes flash )
Normally they have all 128 kB, even if "officially" some have 64 kB You can verify when you load the code with the blackmagic monitor swdp_scan attach 1 load or file compare-sections <<= that will verify all has been written correctly
The whole procedure has apparently gone well, but when I start the device for the first time, it asks me to place the probe to ground, then to put it in DC mode and when I click ok it indicates --processing-- and it hangs... Any suggestion?