Over the last few weeks, the Alpha 2 has had a number of bugs which only seem to affect some people, and its been difficult to track them down.
One problem in particular, was that Jon G4TSN was unable to access his local VHF repeater, but was able to access UHF repeaters. The problem also was only manifest when using a Channel and not if the same repeater was setup on the VFO.
After a lot of experimentation, I found that in the VHF channel, the radio was receiving OK but did not appear to be transmitting, despite the red LED being illuminated. However I attached a power meter to my radio and found that it was actually transmitting, but not on the correct frequency.
Adding some debugging to the code I found that the transmit frequency had been subtly changed somehow between when the Channel was selected and when the radio actually transmitted, and that the frequency was not completely random. But that some of the digits of the frequency (binary digits) had been increased by 1.
An equivalent in decimal, was that the radio changed frequency from 145.725Mhz to 145.826Mhz – but since the numbers are stored in binary the actual frequency seemed to change in a very strange way.
To track the problem down, I had to resort to using hardware watchpoints, in the hardware debugger I have attached to one of my GD-77s, to monitor the memory location that stores the Tx frequency, and I eventually found that the master screen update function was modifying the memory used to store the Tx freq, but this didn’t happen for all channels.
To cut a long story short, the culprit was the code which displays the TG, and Channel name and the Zone name. However when the PTT is pressed, these bits of text have to be moved down the screen to make space for the Talk Timer digits, and the screen is only tall enough to display the TG and Channel name but not the Zone name.
However the code was still attempting to display the Zone name even though the position of the text was below the bottom of the screen, this caused the memory after the screen buffer to be modified my merging with the pixels of the Zone name text characters.
The final solution to the problem was easy. Just don’t display the Zone during Tx ! However finding the cause of the problem took many hours 🙁
This bug could have been causing other problems as potentially around 10 other settings could have been corrupted depending on the Zone name text.
Also, as part of the search for cause of this problem, I have been trying to determine whether the binary code of the AMBE codec, accesses any memory which is also being used by the OpenGD77 firmware, however I have not managed to find this out yet.
Looking at Kai’s code, it wasn’t immediately clear how the memory used by the AMBE codec was being allocated, but after more research and sending an email to Kai, I found that Kai has allocated the entire lower 64k bank of RAM in the MK22 CPU to the AMBE codec.
However doing some tests where i filled the lower 64k RAM with a known pattern (0x55 hexidecimal), and then using the radio for about an hour, before dumping the memory to a file. I discovered that the AMBE coded is only using approximately 8kb of memory in the middle of the lower 64k RAM bank, and the rest is actually available for the OpenGD77 firmware if needed. However I’d need to modify the linker files in order to access this memory, and currently there is around 16k free in the upper 64K, and hence no pressing need to make this change.
What I still don’t know is whether the AMBE codec, may be using some of the upper 64k bank of RAM, and the easiest way to do this is to stop the OpenGD77 firmware using blocks of the upper 64k of RAM and fill them with 0x55 or some other test value and see if they get used.
Anyway, at the moment, because the firmware seems relatively stable, the likelihood is that the AMBE codec only uses some of the lower 64k, and its going to be a while before I can find time to continue this academic investigation.
I think I am now close to having a stable version of the OpenGD77 Tier 2 Alpha 2 that I can release publicly.