Giter VIP home page Giter VIP logo

Comments (19)

Sonnengruesser avatar Sonnengruesser commented on August 17, 2024

Latest working Commit is 4ef5134

from knx.

thelsing avatar thelsing commented on August 17, 2024

That seems to be the same problem as #53 . It would be very nice if you could debug the issue. My SAMD21 test setup is not working ATM.

from knx.

Sonnengruesser avatar Sonnengruesser commented on August 17, 2024

You are right, sounds same. Will try to debug.

from knx.

Sonnengruesser avatar Sonnengruesser commented on August 17, 2024

I'll continue this topic here because the linked Issue title is unrelated.

The issue is here:

obj->writeProperty((PropertyID)propertyId, startIndex, data, numberOfElements);

tracking:
count = prop->write(start, count, data);

to this function, which does not return properly:
uint8_t DataProperty::write(uint16_t start, uint8_t count, const uint8_t* data)

Unfortunately if I add any print() in this function the sketch does compile but doesn't run on my Zero clone. @mjm987 any luck?

from knx.

mjm987 avatar mjm987 commented on August 17, 2024

No unfortunately I had no luck yet, it is hard to debug without SWD Debug Probe.
May be it is a race condition between the main loop and ISRs?
Does anybody know what is handled in ISRs?
I guess all the knx stuff except the SPI- and UART- IO are handled in the main flow isn't it?
May be it happens when a Interrupt raises during the FlashStorage handling?
I don't think it is a stack, heap or buffer overflow during main flow itself.

from knx.

Sonnengruesser avatar Sonnengruesser commented on August 17, 2024

I used a different sketch now and compared the loggings:
Arduino Debug output.txt

The interruption happens every time at the same point, so I don't thing any ISRs cause this. To me it looks like a memory allocation issue, since my project outputs "No available non volatile memory!"

However I can't debug this without debugger.

from knx.

thelsing avatar thelsing commented on August 17, 2024

Maybe the problem is here

size_t size = ((data[2] << 24) | (data[3] << 16) | (data[4] << 8) | data[5]);

I just checked ESP8266 and it still works. I bricked my samd board so I can't check..

from knx.

thelsing avatar thelsing commented on August 17, 2024

@Sonnengruesser can you add which property is written to debug output?

from knx.

thelsing avatar thelsing commented on August 17, 2024

initGroupObjects seems to hang. But I don't understand why.

from knx.

mjm987 avatar mjm987 commented on August 17, 2024

initGroupObjects seems to hang. But I don't understand why.

at least on my Zero (SAMD21) it does not hang in initGroupObjects but somwhere (unknown) else

from knx.

thelsing avatar thelsing commented on August 17, 2024

I tried to find the cause, but I wasn't successful. I ordered Segger Jlink Edu Mini now.

from knx.

thelsing avatar thelsing commented on August 17, 2024

Today I got the debugger, but the knx power supply of my testbed died. ;(
Anyways I debugged the whole evening and still don't understand the error. The debugger goes straight to the hardfault handler at simple lines like htons(...).

I'll try the working version next.

from knx.

mjm987 avatar mjm987 commented on August 17, 2024

may be be a alignment error?

from knx.

mjm987 avatar mjm987 commented on August 17, 2024

I got openocd running using my nrf52 DK as debug interface and yes, it is a alignment error at the end of the code sequence below when accessing to _tableData[0] because _tableData is on a odd address!

bool GroupObjectTableObject::initGroupObjects()
{
println("initGroupObjects() - start");
    if (!_tableData) {
println("initGroupObjects() !tableData");
        return false;
    }
    freeGroupObjects();
    uint16_t goCount = ntohs(_tableData[0]);

@telsing Could you align _tableData to a even address?

from knx.

mjm987 avatar mjm987 commented on August 17, 2024

Ok it works!
As I expected, the problem is a int16 or int32 access to a odd address.
This could be corrected by replacing htons(x) and htonl(x) in "bits.h" by:

#define getbyte(x,n) (*(((uint8_t*)&(x))+n))
#define htons(x)  ( (getbyte(x,0)<<8) | getbyte(x,1) ) 
#define htonl(x) ( (getbyte(x,0)<<24) | getbyte(x,1)<<16) | (getbyte(x,2)<<8) | getbyte(x,3) )

Of course the same might be done by using a union.
And still a bit more efficient would be to align _tableData to a even address because saving multiple bus accesses.

@thelsing: Could you please after verifying update bits.h accordingly?
Thx

from knx.

thelsing avatar thelsing commented on August 17, 2024

@mjm987 I just committed this. I don't have time to test ATM.

from knx.

Sonnengruesser avatar Sonnengruesser commented on August 17, 2024

Commit fixed the issue on the KNX Demo project for me. My other project still doesn't run and gives the "No available non volatile memory!" message. I think this is related, so I keep this issue open for the moment. trying to get rid of stuff on my sketch for further troubleshooting.

from knx.

mjm987 avatar mjm987 commented on August 17, 2024

According the "No available non volatile memory":
Did you try to increase EEPROM_EMULATION_SIZE form 1024 to eg. 2048 in FlashAsEEPROM.h ?

from knx.

Sonnengruesser avatar Sonnengruesser commented on August 17, 2024

Changed my mind, my problem is probably unrelated. Closing this issue now.

from knx.

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.