Code Monkey home page Code Monkey logo

Comments (6)

dvescovi1 avatar dvescovi1 commented on June 7, 2024

the last few packets look like:

88	16.902087	192.168.1.1	192.168.1.146	DNS	156	Standard query response 0xb7ff A testhubti.azure-devices.net CNAME ihsu-eastus-2.eastus.cloudapp.azure.com A 20.49.109.129
89	16.903396	192.168.1.146	20.49.109.129	TCP	62	54335 → 8883 [SYN] Seq=0 Win=8192 Len=0 MSS=1460
90	16.947130	20.49.109.129	192.168.1.146	TCP	60	8883 → 54335 [SYN, ACK] Seq=0 Ack=1 Win=64240 Len=0 MSS=1440

after this I just get a retransmission, I assume because of the failure

No.	Time	Source	Destination	Protocol	Length	Info
99	19.950324	20.49.109.129	192.168.1.146	TCP	60	[TCP Retransmission] 8883 → 54335 [SYN, ACK] Seq=0 Ack=1 Win=64240 Len=0 MSS=1440

from netxduo.

dvescovi1 avatar dvescovi1 commented on June 7, 2024

a bit more information. I was able to correct the hard fault issue by doing this:

    /* Copy the TCP header, since the actual packet can be delivered to
       a waiting socket/thread during this routine and before we are done
       using the header.  */
    /*lint -e{927} -e{826} suppress cast of pointer to pointer, since it is necessary  */

//    tcp_header_copy =  *((NX_TCP_HEADER *)packet_ptr -> nx_packet_prepend_ptr);
    memcpy((void *)&tcp_header_copy, (void *)packet_ptr -> nx_packet_prepend_ptr, sizeof(NX_TCP_HEADER));

not sure this is a good long term solution but after this modification everything seems to work and the device fully registers with Azure and I am receiving telemetering temperature info.
Any more insight?

from netxduo.

TiejunMS avatar TiejunMS commented on June 7, 2024

Could you check the value of packet_ptr -> nx_packet_prepend_ptr? It is required to be 4 bytes aligned for IP header. From your last description, it looks like the fix is related to unaligned access.

from netxduo.

dvescovi1 avatar dvescovi1 commented on June 7, 2024

Thank you for the help. Yes, it looks like that is the issue.
Even though this is an M4F which I understand supports unaligned access (if the SCB_CCR_UNALIGN_TRP_Msk bit in the SBC->CCR register is clear ... which it is) it is still faulting.
I can see the nx_prepend_ptr is at 0x200037d6 which is indeed in RAM space but not 4 byte aligned.
So what is the answer? do all the buffer allocations need to be fixed up so prepend_ptr end up 4 byte aligned? how do you do that?

from netxduo.

goldscott avatar goldscott commented on June 7, 2024

Hi @dvescovi1 - typically, we use the hardware features of the MAC to insert two bytes of padding between the 14-byte MAC header and the payload. This aligns the payload on a 4-byte boundary.

from netxduo.

TiejunMS avatar TiejunMS commented on June 7, 2024

Feel free to reopen the issue if you have further questions.

from netxduo.

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.