Bug fixes for crash bugs in the Scan and general operation

Post Reply
VK3KYY
Posts: 7588
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Bug fixes for crash bugs in the Scan and general operation

Post by VK3KYY » Thu Nov 21, 2019 6:05 am

The new Scan feature developed by Colin G4EML, has shown up a number of bugs in the existing code which I have hopefully now fixed - and are with some of the testers

The crashes mostly seemed to be caused by more than one of the RealTime Operating System (RTOS), tasks attempting to use the I2C bus devices at the same time.
The AT1846S RF transceiver chip and the EEPROM both share the same I2C bus connections, and initially I thought the crash bugs were being caused because the EEPROM and AT1846 were being access simultaneously. However this doesn't seem to be the primary cause of the crash, but rather the DMR subsystem task, was reading the AT1846S RSSI level at the same time as the main UI task was setting the frequency and CTCSS settings, during the Scan functionality.

This problem could actually happen in normal operation, but the chances of it happening when the Scan function changes channels 25+ times a second is greatly increased, hence why the bug seemed to be related to the scanning

The reason I could not simply wrap the function calls to the AT1846 in task swap protection wrappers, is that the DMR subsystem needs to directly control the AT1846S frequency via an Interrupt Service Routine (ISR) and RTOS task control calls can't be used from an ISR

So I've now wrapped all the AT1846S calls that are not from an ISR in the task swap prevention code, and additionally I have a backup system which uses a volatile variable to track whether the I2C bus is in use and if so it rejects further requests.

The problem with the backup, is that most of the code that calls the AT1846 control functions does not check whether the function has suceeded and this could result in something not being set in the AT1846 including the frequency during a DMR transmission.

However in practice it looks like there do not seem to be any low level conflicts caused by the ISR and the RTOS attempting to access the AT1846S at the same time.

In the longer term the AT1846 function call return values should probably be checked, and if they have failed, the function should be called again.


Colin also found a bug in the EEPROM Write function used when updating Channels into the codeplug memory. Which I've now fixed.

This problem was not related to the I2C bus clash despite the EEPROM using the I2C bus, but was caused because I didn't read the data sheet correctly and assumed that I could write up to 128 byte blocks to any address in the EEPROM, but this isnt correct.
The EEPROM has 128 byte boundaries and block writes can't cross a boundary, because doing so causes the data beyond the end of the current 128 byte block to be written into the beginning of the same block.

This bug would cause data corruption when changes were made to Channel settings using the Channel Details screen, and would result in a channel about 4 channels before the active channel being partially overwritten with invalid data.

This is quite a serious bug, but probably has not been noticed before and most people don't change the Channel settings using the Channel Details screen in the radio.

However with the new features like reading the VFO into the Channel (and this function then saving the dated Channel data), as well as people wanting to exclude Channels from the scan by changing the Skip setting, this bug became a lot more obvious.


Daniel also found some bugs in the Talker Alias data handling and that Brandmeister was occasionally sending invalid data as part of the Talker Alias, so he has make some changes to prevent strange characters appearing on the screen as a result of this invalid data.


I also made a change to the Scan function to try to improve the Scanning system's recognition that a DMR signal was present.


All these changes are now in the OpenGD77_latest.sgl file on github

https://github.com/rogerclarkmelbourne/ ... latest.sgl

But I they should not be considered to be 100% stable

User avatar
m1dyp
Posts: 605
Joined: Sat Nov 16, 2019 8:03 am
Location: Hertfordshire, U.K.
Contact:

Re: Bug fixes for crash bugs in the Scan and general operation

Post by m1dyp » Thu Nov 21, 2019 8:07 am

Hi, Still having issues here, its just not stopping on a busy channel anymore, both dmr and analogue, i have downgraded to 343eddb 09.27.48 Nov 20 2019 , the last version that worked. hope this info helps someone.

VK3KYY
Posts: 7588
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Bug fixes for crash bugs in the Scan and general operation

Post by VK3KYY » Thu Nov 21, 2019 8:20 am

Hi Ken

OK

It was stopping on DMR channels for me.

Can you reload your codeplug from your PC, because if you had change the Skip setting using the Channel details screen in the previous versions, it would have messed up some of the codeplug in the radio

User avatar
m1dyp
Posts: 605
Joined: Sat Nov 16, 2019 8:03 am
Location: Hertfordshire, U.K.
Contact:

Re: Bug fixes for crash bugs in the Scan and general operation

Post by m1dyp » Thu Nov 21, 2019 8:33 am

hi roger, all I have been doing is just uploading the firmware, no alterations to channels, but I did as you said, uploaded firmware, then reloaded the code plug, still no change, scan is not stopping at all, i get a click sound as it passes an active channel but doesn't stop. hope this helps

VK3KYY
Posts: 7588
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Bug fixes for crash bugs in the Scan and general operation

Post by VK3KYY » Thu Nov 21, 2019 8:43 am

I see what you mean

It seems to work on DMR but not on FM for me.

I'll investigate

User avatar
m1dyp
Posts: 605
Joined: Sat Nov 16, 2019 8:03 am
Location: Hertfordshire, U.K.
Contact:

Re: Bug fixes for crash bugs in the Scan and general operation

Post by m1dyp » Thu Nov 21, 2019 8:58 am

many thanks

VK3KYY
Posts: 7588
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Bug fixes for crash bugs in the Scan and general operation

Post by VK3KYY » Thu Nov 21, 2019 8:58 am


User avatar
m1dyp
Posts: 605
Joined: Sat Nov 16, 2019 8:03 am
Location: Hertfordshire, U.K.
Contact:

Re: Bug fixes for crash bugs in the Scan and general operation

Post by m1dyp » Thu Nov 21, 2019 9:41 am

hi roger, 00c4f2b, yay its working thank you so so much

User avatar
m1dyp
Posts: 605
Joined: Sat Nov 16, 2019 8:03 am
Location: Hertfordshire, U.K.
Contact:

Re: Bug fixes for crash bugs in the Scan and general operation

Post by m1dyp » Thu Nov 21, 2019 4:28 pm

update: 7c4e4f5 22:10:23 Nov 21 2019. working fine. thank you

VK3KYY
Posts: 7588
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Bug fixes for crash bugs in the Scan and general operation

Post by VK3KYY » Thu Nov 21, 2019 9:33 pm

OK.

I've copied the OpenGD77 latest version to the Stable version, as I think its suitable for everyone to use and does correct some bug

Post Reply