Probable bug in OpenGD77

Discussions related to the firmware code development
JP7NJT
Posts: 32
Joined: Wed Oct 18, 2023 12:44 pm

Re: Probable bug in OpenGD77

Post by JP7NJT » Wed Sep 04, 2024 1:43 am

It's a shame that a developer can't confirm the bug. It's so simple, there are only two lines of code to add as I wrote above.

The bug does not come from the usb_debug_printf function because I noticed before that I had bit losses. As I didn't understand that's when I used the usb_debug_printf function.

I did the tests this way:

md380 with C5000 with modified md380tools firmware (the same way I showed my code above) for (int i=0;i<49;i++) bufferambe [ i ] =... every bit of the silence frame

but I did the same thing with a UV380, a UV380 PLUS, a UV390 PLUS, a DM1701.

Therefore:

md380 C5000 -> md380 C5000, no bits lost or changed

md380 C5000 -> uv380 opengd77 c6000 or uv380 plus or uv390 plus or dm1701, lost bits

UV 380 or UV380 Plus or UV390 Plus or DM1701 OpenGD77 -> UV380 or UV380 Plus or UV390 Plus or DM1701 Bit Lost

I did all the possible configurations.

and even: UV380, UV390 Plus, UV380 Plus, DM1701 -> MD380 C5000 No Bit Lost

So in transmission with OpenGD77: no bit lost only loss on RX with md380 C5000.

And so on DSD-FME, we don't see any bit loss because it's only in RX on OpenGD77 that the bits are lost.
Your presumption that there is a in the code presumes that the C6000 is receiving clean audio from the receiver and that your modulation is clean, or have you already verified this?
I don't use the microphone for my tests, it's after the microphone in the ambe buffer that I change the data. so no modulation problem because I change the data after the WAV to AMBE conversion and before the FEC conversion.

I was able to verify with DSD-FME that the ON AIR transmissions are without transmission error.
The TRx chip used in the UV380 is totally different from the Tx Rx system in the MD380 and the Rx side of the TRx chip is known to be poor quality and also susepetable to interference both in band and out of band, and also is not tollerant of signal overloading.

Currently there are many places in the process where your 'silence frame' data could have errors introduced. I don't understand your presumption that this must be a bug in the firmware, when it could be a RF / AF problem
That's why I would have liked (if possible) a developer to be able to confirm what I found, even without looking for the bug. Just to confirm that what I found also exists with him. There are just two lines of code to add in TX and two lines to add in RX.

If adding the two lines is a problem, I can post here the codec_interface.c file to add it to the project and recompile but it seems easier to me to add the two lines of code (in my opinion).
To remove the possiblity that its a RF / AF problem you would need to generate the 4FSK AF encoded signal some other way, and directly inject this into the PCB of the radio, and then adjust the modulation level and attempt to confirm whether this problem is AF/RF
I don't have that technical ability, I just know how to work at the software level.
If this is not fast enough you will need to change the clock settings for the entire chip. If you change the CPU clock frequency so that everything runs faster, that you need to ensure that the clock multiplier and divider frequencies provide the correct clock speed for the USB subsystem in the STM32, otherwise USB won't work. Also check the GPIO / SPI / I2C subsystem clock dividers etc to ensure you are not overclocking them if you increase the CPU core frequency.
USB Debug printing works perfectly well with the March 2023 code. just it doesn't work anymore with the December 2023 code. What did you do about the December 2023 code to make it no longer work?

User avatar
F1RMB
Posts: 3426
Joined: Sat Nov 16, 2019 5:42 am
Location: Grenoble, France

Re: Probable bug in OpenGD77

Post by F1RMB » Wed Sep 04, 2024 3:48 am

JP7NJT wrote: ↑
Wed Sep 04, 2024 1:43 am
It's a shame that a developer can't confirm the bug. It's so simple, there are only two lines of code to add as I wrote above.

The bug does not come from the usb_debug_printf function because I noticed before that I had bit losses. As I didn't understand that's when I used the usb_debug_printf function.

I did the tests this way:

md380 with C5000 with modified md380tools firmware (the same way I showed my code above) for (int i=0;i<49;i++) bufferambe [ i ] =... every bit of the silence frame

but I did the same thing with a UV380, a UV380 PLUS, a UV390 PLUS, a DM1701.

Therefore:

md380 C5000 -> md380 C5000, no bits lost or changed

md380 C5000 -> uv380 opengd77 c6000 or uv380 plus or uv390 plus or dm1701, lost bits

UV 380 or UV380 Plus or UV390 Plus or DM1701 OpenGD77 -> UV380 or UV380 Plus or UV390 Plus or DM1701 Bit Lost

I did all the possible configurations.

and even: UV380, UV390 Plus, UV380 Plus, DM1701 -> MD380 C5000 No Bit Lost

So in transmission with OpenGD77: no bit lost only loss on RX with md380 C5000.

And so on DSD-FME, we don't see any bit loss because it's only in RX on OpenGD77 that the bits are lost.
Your presumption that there is a in the code presumes that the C6000 is receiving clean audio from the receiver and that your modulation is clean, or have you already verified this?
I don't use the microphone for my tests, it's after the microphone in the ambe buffer that I change the data. so no modulation problem because I change the data after the WAV to AMBE conversion and before the FEC conversion.

I was able to verify with DSD-FME that the ON AIR transmissions are without transmission error.
The TRx chip used in the UV380 is totally different from the Tx Rx system in the MD380 and the Rx side of the TRx chip is known to be poor quality and also susepetable to interference both in band and out of band, and also is not tollerant of signal overloading.

Currently there are many places in the process where your 'silence frame' data could have errors introduced. I don't understand your presumption that this must be a bug in the firmware, when it could be a RF / AF problem
That's why I would have liked (if possible) a developer to be able to confirm what I found, even without looking for the bug. Just to confirm that what I found also exists with him. There are just two lines of code to add in TX and two lines to add in RX.

If adding the two lines is a problem, I can post here the codec_interface.c file to add it to the project and recompile but it seems easier to me to add the two lines of code (in my opinion).
To remove the possiblity that its a RF / AF problem you would need to generate the 4FSK AF encoded signal some other way, and directly inject this into the PCB of the radio, and then adjust the modulation level and attempt to confirm whether this problem is AF/RF
I don't have that technical ability, I just know how to work at the software level.
If this is not fast enough you will need to change the clock settings for the entire chip. If you change the CPU clock frequency so that everything runs faster, that you need to ensure that the clock multiplier and divider frequencies provide the correct clock speed for the USB subsystem in the STM32, otherwise USB won't work. Also check the GPIO / SPI / I2C subsystem clock dividers etc to ensure you are not overclocking them if you increase the CPU core frequency.
USB Debug printing works perfectly well with the March 2023 code. just it doesn't work anymore with the December 2023 code. What did you do about the December 2023 code to make it no longer work?
I think you're lacking some FreeRTOS knowledge, like task locking/switching/context. You can't use USB_DEBUG_printf()/USB_DEBUG_PRINT() anywhere you want (and va_start/vnsprintf/va_end() take cycles).

Roger and Colin gave you all the needed details to continue your investigations, but I'm not sure you really read that.

JP7NJT
Posts: 32
Joined: Wed Oct 18, 2023 12:44 pm

Re: Probable bug in OpenGD77

Post by JP7NJT » Wed Sep 04, 2024 4:12 pm

I think you're lacking some FreeRTOS knowledge, like task locking/switching/context. You can't use USB_DEBUG_printf()/USB_DEBUG_PRINT() anywhere you want (and va_start/vnsprintf/va_end() take cycles).

Roger and Colin gave you all the needed details to continue your investigations, but I'm not sure you really read that.
I am infinitely sorry that we do not understand each other. Yes, I have read that I am told that I cannot use usb_debug_printf in the codec_interface.c and there is a whole list of things that is said to me to make it work.

But I'm telling you that usb_debug_printf works, I manage to display what I want in the codec_interface.c code

The only condition is that there is only one usb_debug_printf per call of the function (all code must be on the same line).

If there are two usb_debug_printf in a function call, then yes that loses data. But if there is only one, it works.

That being said, my question is as follows and I just ask for an answer by yes or no.

Like usb_debug_print works in the March 2023 code but no longer works In the December 2023 code, did you remove code for this feature in the December 2023 code? Yes/No

The second point is this: I noticed the bit losses before to use the usb_debug_printf function, so bit losses don't come from this function.

I have only one question: can someone (even a non-developer) try it and confirm this loss of bits?

I attach two ready-made files for UV380/390 and DM1701.
OpenMDUV380-DEBUG.bin.zip
(191.19 KiB) Downloaded 132 times
OpenDM1701-DEBUG.bin.zip
(191.15 KiB) Downloaded 125 times
everything is compiled and ready to use, all you have to do is load the files.bin on a UV380/390 or DM1701.
you can use two UV380/390 or two DM1701 or both.

Just plug in one of the two with the cable and connect with Putty on the corresponding COM port with the speed of 115200.

With the other radio you TX and you just have to look in Putty if the received frames are correct (silence frames) or if it is bitwise change as in the attached picture.
bug RX.png
bug RX.png (18.91 KiB) Viewed 6774 times

G4EML
Posts: 1056
Joined: Sat Nov 16, 2019 10:01 am

Re: Probable bug in OpenGD77

Post by G4EML » Wed Sep 04, 2024 5:08 pm

I am quite busy at the moment, as are the other developers, however I will try to find some time to look at this.

Colin G4EML

JP7NJT
Posts: 32
Joined: Wed Oct 18, 2023 12:44 pm

Re: Probable bug in OpenGD77

Post by JP7NJT » Wed Sep 04, 2024 5:27 pm

G4EML wrote: ↑
Wed Sep 04, 2024 5:08 pm
I am quite busy at the moment, as are the other developers, however I will try to find some time to look at this.

Colin G4EML
thank you very much !

G4EML
Posts: 1056
Joined: Sat Nov 16, 2019 10:01 am

Re: Probable bug in OpenGD77

Post by G4EML » Wed Sep 04, 2024 8:44 pm

I can reproduce your findings using your test firmware on my two radios.

One thing I noticed is that the apparent errors always seem to occur in the last 3 bytes of the AMBE frame. Never in the first three. That seems strange, and I don't understand why that would be at the moment.

On the surface this looks like it might be a bug but I don't have the time tonight to confirm this or investigate further. I will try to look closer in the next few days.

Colin G4EML

JP7NJT
Posts: 32
Joined: Wed Oct 18, 2023 12:44 pm

Re: Probable bug in OpenGD77

Post by JP7NJT » Wed Sep 04, 2024 11:00 pm

Thank you so much for confirming what I found. Yes, I noticed that it's not in the three first bytes but in the three last ones.

A test to do would be to do the same thing on a GD-77, a DM-1801, RD-5R, GD-77S, MD-9600, RT-90, MD2017, RT-82.
If it's the same it's because the bug is in OpenGD77.

Unfortunately, I don't have these other radios to test.
If anyone has these other radios, I can try to compile "blindly" for these radios.

JP7NJT
Posts: 32
Joined: Wed Oct 18, 2023 12:44 pm

Re: Probable bug in OpenGD77

Post by JP7NJT » Wed Sep 04, 2024 11:39 pm

Here are files for these devices but compiled blindly. if anyone wants to test...
OpenGD77S-DEBUG.zip
(130.25 KiB) Downloaded 178 times
OpenGD77-DEBUG.zip
(140.18 KiB) Downloaded 195 times
OpenDM1801-DEBUG.zip
(139.48 KiB) Downloaded 194 times

JP7NJT
Posts: 32
Joined: Wed Oct 18, 2023 12:44 pm

Re: Probable bug in OpenGD77

Post by JP7NJT » Wed Sep 04, 2024 11:39 pm

and the last one
OpenRD5R-DEBUG.zip
(137.01 KiB) Downloaded 163 times

SA0BUX
Posts: 873
Joined: Tue Jul 05, 2022 8:50 am
Location: JO99ah, Stockholm, Sweden
Contact:

Re: Probable bug in OpenGD77

Post by SA0BUX » Thu Sep 05, 2024 6:35 am

Tried with two RT3S (STM Based)
Radio 1 to radio 2

decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F CC E0
decode:F8 01 A9 9F 8C E4
decode:F8 01 A9 9F CC E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F CC E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F CC E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F CC E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F CC E0
decode:F8 01 A9 9F 8C E8
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F CC E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F CC E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F CC E0
decode:F8 01 A9 9F 8C E0
decode:F8 01 A9 9F CC E0
decode:F8 01 A9 9F 8C E0
Last edited by SA0BUX on Thu Sep 05, 2024 6:38 am, edited 1 time in total.