Gissio / radpro

Custom firmware for Geiger counters/radiation meters (FS2011, Bosean FS-600, FS-1000, FS-5000, FNIRSI GC-01)
MIT License
154 stars 20 forks source link

Bosean FS-600: Debugging #17

Closed Dsl71 closed 4 months ago

Dsl71 commented 6 months ago

I tried the new 2.0 beta16 on a board revision KL7 820.403D. The display had all pixels set to black, no background light, text was only readable in a very steep angle. keyboard seems to fail also. Klicks were hearable, the LED was flashing also.

Back to 2.0beta10 everything worked again.

Gissio commented 6 months ago

A regression, how sad. Does this work?

radpro-bosean-fs600-2.0beta17-test1.bin.zip

Dsl71 commented 6 months ago

this is only 32k instead of 128k, is this okay to flash?

Gissio commented 6 months ago

Yep. It'll complain with a checksum error because the firmware is not signed, but other than that, it should work.

Gissio commented 6 months ago

Oh, the settings might be wrong, but you can correct them.

Dsl71 commented 6 months ago

Just flashed it. After powering, the led flashes about 5 times and then it starts with checksum error display and then it shows everything normal. Btw, first time to see an output from the random generators. Cudos to you, Gissio ;-)

PS: On my FS2011 the 2.0beta16 seems to work fine. (radpro-fs2011-gd32f150c8-2.0beta16-install.bin) With the exception that the random generators don't show an output (font colour problem?)

Gissio commented 6 months ago

I'm glad it works now.

Do the new display contrast/brightness settings work? Does the dead-time measurement (statistics) work? Is the battery indicator working?

Dsl71 commented 6 months ago

Bosean FS-600:

display contrast/brightness settings work: yes (also on FS2011) battery indicator working: no, shows empty batteries (they are new 1,5v AAA) (also on FS2011) dead-time shows < 1078.0 µs (on FS2011 with SBM20: < 0.0 µs)

But biggest problem: settings and dose are still lost after power cycle. (works on FS2011) RNG shows values: yes (no on FS2011) LED on/off not working on every FS-600 device. (allways on on DG0MG device)

Dsl71 commented 6 months ago

Bosean FS-600: After about 11h runtime dead-time shows < 1.7 µs Contrast level 7&8 are useless, you can't read anything

Dsl71 commented 6 months ago

Bosean FS-600: After about 46h runtime dead-time shows < 0.0 µs

Gissio commented 5 months ago

I just released 2.0beta17. It should fix the dead-time measurement and battery level readout. Also, settings should work now.

Dsl71 commented 5 months ago

hmm, flashed it , but only the led is red all the time, no display text,no display led. seems to track pulses still (led is then off while click sound)

Gissio commented 5 months ago

Can you make a video and share it here?

Dsl71 commented 5 months ago

Uff, even a 5 sec video is too big. so:

thats all

Dsl71 commented 5 months ago

https://github.com/Gissio/radpro/assets/57271038/a366396e-46e1-445b-8007-94acaee67f55

Gissio commented 5 months ago

That video helped a lot, thanks! I'll keep you updated.

Gissio commented 5 months ago

I just released Rad Pro 2.0beta18. Can you go over this checklist?

Dsl71 commented 5 months ago

YES- The display/backlight works. NO- Settings are stored to flash memory. PARTLY**- The radiation alarms work (flash the screen and beep). YES- While unplugged, the battery indicator works correctly. YES- While plugged, the battery indicator shows a lighting icon. NO-The temperature indicator in the statistics menu shows reasonable values. YES***- The random generator and dead-time compensation work. TBD- The serial port communication works. TBD- Data logging works and you can download the datalog with radpro-tool.

Gissio commented 5 months ago

I'm sorry, I meant dead-time measurement, not dead-time compensation. If you can't enter the statistics screen, you can't do this for now.

Can you try dumping the contents of the flash memory to a file and upload it here? I'm suspecting the program code is being overwritten. This command should do the trick:

st-flash read backup.bin 0x08000000 0x20000
Dsl71 commented 5 months ago

backup_boseanfs600_2_0_beta18.zip

Here it is, its the same content than the original flash file.

Gissio commented 5 months ago

First, thanks for your patience.

I am sending you beta19-test4.

radpro-bosean-fs600-2.0beta19-test4-install.bin.zip

If the statistics view crashes, you should hear a series of pulses, after which the device should turn itself off. Please make a recording of these pulses using a voice recorder and attach it here to a message. This will let me know where the problem is.

Also, let me know if the settings are saved now.

Dsl71 commented 5 months ago

No Problem, thank you for your effort to transform trash counters to good counters!

Settings are not saved.

Entering the statistics screen, immediate freeze, no pulses,no shutdown.

Sorry, i have no better news.

Gissio commented 5 months ago

Beta20 (https://github.com/Gissio/radpro/releases) should fix the statistics screen crash.

Dsl71 commented 5 months ago

hmm statistics screen doesn't crash, values (temp between -303 to 125 °C) seems to be not correct. Settings are not saved. deadtime shows -. After some time, 22 pulses, deadtime < 86000.0 µs After some time, 207 pulses, deadtime < 32.0 µs After some time, >1000 pulses, deadtime saturates at < 32.0 µs

Temp is - 304°C, i have to heat up my room :-)

Gissio commented 5 months ago

I forgot to ask, does the battery indicator show the correct level of charge when unplugged?

Dsl71 commented 5 months ago

Alkaline battery, 3,9V , battery indicator shows 100% set as Ni-MH, about 30-40% set as Alkaline. But they are very weak already,have to get new ones.

Tell me what voltages i should apply with a power supply to get better readings.

Gissio commented 5 months ago

Ok. I think I found the temperature problem: on the STM32F0x1 and STM32F1x3, temperature is available on ADC channel 18; on the STM32G07x, temperature is available on ADC channel 12.

So we're just left with the flash program problem. I'll keep you updated.

Gissio commented 5 months ago

I just released ~beta21~ beta23. The statistics view should show the device battery voltage (per cell) instead of the temperature. Are settings preserved now?

Dsl71 commented 5 months ago

no good news for beta22 and beta23. Battery voltage shown around 1.45V, plugged,no bat attached around 0.3V, no settings saved.

Gissio commented 5 months ago

Ok.

There goes beta23-test1:

radpro-bosean-fs600-2.0beta23-test1-install.bin.zip

You should see a "FLASH_SR=" line in the status bar, followed by hexadecimal numbers.

Please turn on datalogging to 1 minute. The numbers should change. Let me know what numbers you see. Do the numbers change after one minute? Two minutes? To what value(s)?

Thanks.

Dsl71 commented 5 months ago

0x00000000 -> 0xc0000000 after enabling data logging of 1 minute. 0xc0000000 remains all the time (5 minutes runtime or so)

Gissio commented 5 months ago

I think I'm onto something:

radpro-bosean-fs600-2.0beta23-test2-install.bin.zip

Can you repeat the previous steps? And check if settings are saved now?

Dsl71 commented 5 months ago

0x00000000 -> 0x00000008 after enabling data logging of 1 minute. 0x00000008 remains all the time (5 minutes runtime or so) Settings are not saved. After reboot, if only settings are changed, value remains at 0x00000000.

FYI: I do all of this usb powered.

Gissio commented 5 months ago

Ok, here is what is happening: the flash controller is reporting a PROGERR, which happens when attempting to write data to a memory location that was already written. I have no idea why this should occur. But at least I know what to look for.

I have another suspicion for this nasty bug. I will report once I have news.

Dsl71 commented 5 months ago

Hmm, maybe you have to erase the used sectors before writing to them?

Gissio commented 5 months ago

Here's what I think is happening.

The STM32G070 has flash memory with error correction, so it has invisible error correction bits. So, whenever a value is written to this flash memory, the error correction bits are also set (even though they are invisible).

The Rad Pro "-install" firmware initializes settings and datalog memory to the value of erased STM32 flash memory. But because of these error correction bits, the STM32G070 detects that data has been previously written (by the st-link.exe flash software), and, correctly, refuses to reflash memory.

So, indeed it is necessary to erase the flash memory again.

Let's try beta23-test3:

radpro-bosean-fs600-2.0beta23-test3-install.bin.zip

Do we agree that this is very nasty?

Dsl71 commented 5 months ago

I agree, a nasty bug. But still no good news, settings are not saved, the FLASH_SR= line is missing too.

Gissio commented 5 months ago

I fixed a logic error. Same as before, with FLASH_SR:

radpro-bosean-fs600-2.0beta23-test5-install.bin.zip

Dsl71 commented 5 months ago

0x00000000 -> 0x00000008 after enabling data logging of 1 minute. 0x00000008 remains all the time (5 minutes runtime or so) After reboot, if only other settings are changed, value remains at 0x00000000.

If before data logging was activated, value is now 0x00800008 when settings are changed. Same when only data logging is changed, it is a settings change. The 0x00800008 comes when leaving menues. Settings are not saved.

Gissio commented 5 months ago

Can you try again?

radpro-bosean-fs600-2.0beta23-test6-install.bin.zip

If it fails, can you download the flash memory with st-link.exe read and let me know if something changed, and how?

Dsl71 commented 5 months ago

Yippie! partly success!!! What happens: Change settings,leave menu, power cycle -> settings are here. Do another power cycle without changing any settings -> settings are default again.

Gissio commented 5 months ago

The good news is that this is possibly due to an unrelated problem. Settings were not memory aligned to 8-byte flash words; the STM32G070 requires this. It should work now.

radpro-bosean-fs600-2.0beta23-test7-install.bin.zip

Dsl71 commented 5 months ago

Well done Sir!

For the first time settings are safed !!!!! Cudos, Gissio

Gissio commented 5 months ago

I'm glad it works now.

I've just released rc1 (release candidate 1). Can you check if datalogging works with the Bosean FS-600?

I've also added compatibility with GeigerLog. Does this work: https://github.com/Gissio/geigerlog-radpro ?

Dsl71 commented 5 months ago

` flash_unlock();

for (uint32_t i = 0; i < size; i += FLASH_WORD_SIZE)
{
    if (!flash_program(dest + i, source + i))
    {
        if (!flash_erase_page(iterator->pageIndex))
            break;

        if (!flash_program(dest + i, source + i))
            break;
    }
}

flash_lock();

`

Ah i see the new flash code, looks clean and device independent. I will flash rc1 and report back.

BTW what exactly stores the datalogging? actual value, average value?

Dsl71 commented 5 months ago

Ha a first connect and data collect with geigerlog-radpro works :-)

Dsl71 commented 5 months ago

First datalogging history...

At 11:25 i placed a hotter source under the counter

history

Dsl71 commented 5 months ago

Bug:

Logging stops than, last entries:

13:28:08.8 348. 10.9 . . . . . . . . . .
13:28:09.8 401. 7.03 . . . . . . . . . .
13:28:10.8 361. 0 . . . . . . . . . .

for me this seems to be a communication problem...

grafik

Dsl71 commented 5 months ago

grafik

Dsl71 commented 5 months ago

grafik

Gissio commented 5 months ago

Regarding your first question: data logging stores cumulative pulse count. From there both rate and dose can be calculated.

Regarding the problem with datalogging: try the new geigerlog-radpro release. It shouldn't crash when requests don't get answered in time (there is a 250 ms timeout when the serial port is opened).