[minima] Re: Ver.0.030 code problems

  • From: Thomas Sarlandie <thomas@xxxxxxxxxxxxx>
  • To: "minima@xxxxxxxxxxxxx" <minima@xxxxxxxxxxxxx>
  • Date: Sat, 29 Mar 2014 16:59:11 -0700

Mac,

I have modified the Si570 class so that I could initialize it and pass the
register values manually. Using Jerry's register values, I was able to
reproduce the bug.
And I can confirm that the problem is fixed by the code you sent.

Good news is that it is not dependent on where it is compiled computer and
it should work for everyone now.

I have used your version which I liked better and made a PR for farhan:
https://github.com/afarhan/radiono/pull/7

Jerry, I am very confident this fixes your problem but could you give it a
try?
Download it with this zip file:
https://github.com/sarfata/radiono/archive/fix-si570-stuck-bug.zip


Now of course, we want to understand what was going on. It was not
obvious...

Line 87, we used to do:
dcoFrequency |= this->dco_reg[11] << 8;

When we do this, the compiler extends the sign-bit (the most significant
bit) to the left before it does the OR operation. With my Si570, I had 0x77
so this bit was 0 but Jerry had 0xbf and therefore a 1. This is what messed
up completely the rest of the calculations...

I checked and apparently the problem is that we were shifting a 8 bit
number (uint8_t) by 8 bits and the results seem to be undefined.

73,
thomas


On Sat, Mar 29, 2014 at 2:39 PM, Mac A. Cody <maccody@xxxxxxx> wrote:

> Jerry,
>
> Apparently the last few lines of the experimental Arduino sketch I sent
> you left out some code.
>
> After these lines of code:
>   //set the initial frequency
>   vfo->setFrequency(SI570_NEW_FREQUENCY);
>
> add the following lines of code:
>   delay(3000);
>   // This will print some debugging info to the serial console.
>   vfo->debugSi570();
>
> Please rerun the tests.  This explains why you did not get the second
> set of serial output.  That is one thing I DO NOT LIKE about the
> Arduino IDE.  Compiling is done in the IDE environment and code
> changes are not saved to the source files unless done explicitly.
> If the Arduino IDE were to crash before an explicit save, a lot of
> changes could be lost.  I consider this to be a bad bug. Auto-save
> of source code changes during compile is a must.
>
>
> 73,
>
> Mac AE5PH
>
> On 03/29/2014 02:39 PM, jerry@xxxxxxxxxxxxxxxx wrote:
>
>> Thomas, attached are tests I did, including the testing.ino that Mac
>> sent me. We were checking to see if the chip would change frequencies.
>> It did, I made three tests. All with my original board. With the new
>> board, I loaded ver. 0.030 and got the results attached as,
>> "newdigoboard". This is when I thought maybe my board had a trace that
>> was bad, and I took my soldering iron and was going to pull solder down
>> the traces to thicken them.  I didn't realize that I still had the power
>> to the board on and when I touched the soldering iron to the trace I
>> fried the si570. So I'm back to one board. But when I started up the
>> ver. 0.030 before I fried the chip, it said I had a comm error.  My old
>> board never gave that message. Before I loaded ver 0.030 on the new
>> board the testing sketch was the same as the old board.  I bought both
>> chips from DigiKey and they have the same "CAC000141G" on the chip. I
>> will run any tests you need me to. Jerry
>>
>> K5LRU
>> Harwood, Texas
>>
>>  -------- Original Message --------
>>> Subject: [minima] Re: Ver.0.030 code problems
>>> From: Thomas Sarlandie <thomas@xxxxxxxxxxxxx>
>>> Date: Sat, March 29, 2014 1:26 pm
>>> To: "minima@xxxxxxxxxxxxx" <minima@xxxxxxxxxxxxx>
>>>
>>>
>>> Frank, Jerry,
>>>
>>> I think at this point we are pretty sure that the bug is because we are
>>> using different variants of the Si570. I am working on it now to make a
>>> v0.0.4 that would work for everyone.
>>>
>>> Jerry, to help me test my changes, can you send me the output of the
>>> serial
>>> console when you start your second minima?
>>>
>>> Every Si570 is different and I will run the maths manually to make sure
>>> there is no bug in the source code anymore.
>>>
>>> thanks!
>>> thomas
>>>
>>>
>>> On Sat, Mar 29, 2014 at 10:52 AM, Frank <w4nhj@xxxxxxxxxxx> wrote:
>>>
>>>    Jerry,
>>>>
>>>> I use a Mac, you know I believe Thomas also uses a Mac.  I wonder if you
>>>> have hit on something.
>>>>
>>>>   Frank - W4NHJ
>>>>
>>>> -
>>>> On 3/29/14, 1:14 PM, jerry@xxxxxxxxxxxxxxxx wrote:
>>>>
>>>> Frank, thanks for sending the files, I will compare the code to mine.
>>>> What operating system do you run your Arduino software with? Jerry
>>>>
>>>> K5LRU
>>>> Harwood, Texas
>>>>
>>>>
>>>>   -------- Original Message --------
>>>> Subject: [minima] Re: Ver.0.030 code problems
>>>> From: Frank <w4nhj@xxxxxxxxxxx> <w4nhj@xxxxxxxxxxx>
>>>> Date: Sat, March 29, 2014 11:03 am
>>>> To: minima@xxxxxxxxxxxxx
>>>>
>>>>
>>>> Jerry,
>>>>
>>>> I tested my digital board with the V0.03 firmware and it works.  I could
>>>> send you the three files I have and you can see if that works.  Perhaps
>>>> something was changed in the firmware that is on Github now, but I
>>>> doubt it.
>>>>
>>>> Frank - W4NHJ
>>>>
>>>> -
>>>> On 3/29/14, 11:34 AM, Celso - PY2XT wrote:
>>>>
>>>>   Hi Jerry and folks,
>>>>
>>>> I have the same problem with my digital board, just like you.
>>>>
>>>> I will continue researching and wait for help from more experienced
>>>> friends.
>>>>
>>>> 73 to all.
>>>>
>>>> Celso - PY2XT.
>>>>
>>>>
>>>> De: jerry@xxxxxxxxxxxxxxxx
>>>> Enviada: Sábado, 29 de Março de 2014 07:02
>>>> Para: minima@xxxxxxxxxxxxx
>>>> Assunto: [minima] Ver.0.030 code problems
>>>>
>>>> I bought a new si570, built a new digi-board, and guess what, I still
>>>> have the same problem. The si570 is frozen at 56.3 Mhz. I got a test
>>>> sketch from Mac (I put my callsign in the code to make sure I was
>>>> pulling up the right file through Arduino) see attachment, and I am able
>>>> to change the frequency of the si570 with the sketch which proves the
>>>> I2C bus is working OK. The chip puts out a clean signal at around 2.84v
>>>> peak to peak, (see attachments). With Farhan's original sketch, the
>>>> si570 will tune. I think I've read everything there is on the internet
>>>> about the I2C buss, and I don't think that's my problem, unless it is
>>>> running too fast with the new version code. I made my own digi board
>>>> pcb, but it was from Adrian's design, so it should be the same as
>>>> everyone else. The voltages on the si570 are at 3.274. I'm out of ideas.
>>>> I need help. Jerry
>>>>
>>>> K5LRU
>>>> Harwood, Texas
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>
>

Other related posts: