Git Product home page Git Product logo

Comments (18)

gabonator avatar gabonator commented on July 20, 2024

Please send screen shot

from la104.

magicroomy avatar magicroomy commented on July 20, 2024

from la104.

gabonator avatar gabonator commented on July 20, 2024

Where is the picture?

from la104.

magicroomy avatar magicroomy commented on July 20, 2024

Here they are.
The SPI output was created by a ESP32 set to SPI Mode0 and MSB

As Said: The Bit order of the MOSI is 1 0 1 1 1 0 1 1, which is indeed BB for MSB as shown by the decoder, but it is configured as LSB and then it should be DD.

LA104_Waveform
LA104_Setting

from la104.

gabonator avatar gabonator commented on July 20, 2024

When you switch to MSB, will it show 0xDD?

from la104.

magicroomy avatar magicroomy commented on July 20, 2024

Yes it does

from la104.

gabonator avatar gabonator commented on July 20, 2024

Bit order in decoder:
https://github.com/gabonator/LA104/blob/master/system/apps/test17_official/source/Analyze.c#L29
MSB/LSB constants:
https://github.com/gabonator/LA104/blob/master/system/apps/test17_official/source/Analyze.h#L12
Menu:
https://github.com/gabonator/LA104/blob/master/system/apps/test17_official/source/Menu.c#L994

gInputSubParam[IN_SPI][3] holds the information what kind of signal we are going to decode:

memcpy(&param_str[LEN * 3], (gInputSubParam[IN_SPI][3] ? " MSB " : " LSB "), SIP_PARAM_STR_LEN);

where 0 means LSB and 1 MSB

#define  LSB           0   // 
#define  MSB           1   // 

SPI_AnalyzeFrame does the decoding part:

                if(CLK_Phase == 1)                         // 
                {
                    if(SCK_Now == CLK_Polarity)
                    {
                        AnalyzeBuf[j * 3 + 0] |= BIT_Order ? ((Status & 0x01) << k) : ((Status & 0x01) << (7 - k));
                        AnalyzeBuf[j * 3 + 1] |= BIT_Order ? (((Status >> 1) & 0x01) << k) : (((Status >> 1) & 0x01) << (7 - k));
                        if(k < 7) k++;
                    }
                }
                else                                       // 
                {
                    if(SCK_Now != CLK_Polarity)
                    {
                        AnalyzeBuf[j * 3 + 0] |= BIT_Order ? ((Status & 0x01) << k) : ((Status & 0x01) << (7 - k));
                        AnalyzeBuf[j * 3 + 1] |= BIT_Order ? (((Status >> 1) & 0x01) << k) : (((Status >> 1) & 0x01) << (7 - k));
                        if(k < 7) k++;
                    }
                }

k is incrementing from 0 to 7, it holds the bit index. This expression BIT_Order ? ((Status & 0x01) << k) : ((Status & 0x01) << (7 - k)) should evaluate the bit weight, probably all of these 8 partial values are later summed together to get transmitted/received value. When decoding LSB frame, the first bit should give value 1 and 128 for MSB respectively. For LSB the Bit_Order is zero (false), so the second term is evaluated ((Status & 0x01) << (7 - k)) which is wrong.
I recommend changing BIT_Order ? ..... into (BIT_Order == LSB) ? ... which will invert the condition to fix this problem.

from la104.

gabonator avatar gabonator commented on July 20, 2024

Try this:
17analys.zip

from la104.

magicroomy avatar magicroomy commented on July 20, 2024

I renamed the original analyser.elf to enalyser.elf___ and took the content of your 17analys.zip and put it into the device as analyser.elf
Restart of the device. analyer started.. I am afraid. Exactly the same display.. BB on setting LSB ;-(

I am not familiar with the whole code but what about just inverting the Bit Order
......AnalyzeBuf[j * 3 + 0] |= BIT_Order ?.....

to
.....AnalyzeBuf[j * 3 + 0] |= ! BIT_Order ?.....
?
could that help ? (of course for all 4 ocurences)

from la104.

gabonator avatar gabonator commented on July 20, 2024

!BIT_Order, BIT_Order == 0, BIT_Order != 1, BIT_Order == LSB, BIT_Order != MSB, all are equal. But ternary operator is a bit tricky, because you never know, if the negation operator !a ? b : c is applied on the first argument, or on the result, so it is always safer to put the condition in parenthesis (!a) ? b : c

from la104.

gabonator avatar gabonator commented on July 20, 2024

I didn't notice that there are 8 places with this code, not four. Try this
17analys.zip

from la104.

magicroomy avatar magicroomy commented on July 20, 2024

yeah you are abolutely right with the parenthesis.
AND ! Tadaaa. I seems to work now. I owe you something

from la104.

magicroomy avatar magicroomy commented on July 20, 2024

Funny enough after YEARS of the LA104 being on the market I am the first to notice??? Hmmm :-)
And congrats to you for your work on this alternative firmware. Bombastic work !

from la104.

gabonator avatar gabonator commented on July 20, 2024

I would really like to know how many units did they sell and how many are actually used... but thank you for reporting this issue

from la104.

magicroomy avatar magicroomy commented on July 20, 2024

Glad that you could help me :-)

from la104.

gabonator avatar gabonator commented on July 20, 2024

You are welcome :) But why are you on friday night fighting with logic analyser and not somewhere out with friends and drinking beer? :)

from la104.

magicroomy avatar magicroomy commented on July 20, 2024

Poor me.. I am sick at home while they have one after the other :-( (pity is welcome)

from la104.

gabonator avatar gabonator commented on July 20, 2024

Fixed here a8904d5

from la104.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.