TCP/IP stack trapping

Discussion to talk about software related topics only.
romanluba
Posts: 12
Joined: Mon Oct 26, 2020 6:03 am

TCP/IP stack trapping

Post by romanluba »

I am trying to implement a TCP/IP task using a combination of give examples from the Standard Stack, and I'd say I'm still a beginner programmer. I'm working on the SB70LC and I want a dual implementation for IPv4 and IPv6. I have been testing my code by connecting the ethernet directly to my laptop, or testing through a small local network using a router and it has been working fine. It very closely resembles the 'multisocket tcp server' example from the standard stack. I have 3 tasks total, one that handles a state machine like loop, one that checks the I/O and another that runs TCP sockets and communicates messages between them.

The issue: About 20 seconds after I connect it to the intended network connector it traps with a Trap Vector of 'Access Error (2)' format 04, and it continues to do so over and over. The interesting thing is that it performs the same trap when I simply use an IPv6 example from the given Netburner examples in the Standard Stack folder.

I have tried to:
Switch SB70LC devices
different examples from the standard stack (TCP examples, IPv6 examples)
Looking for potential memory leaks in my code (however I feel like using a new unprogrammed SB70LC with a simple DHCP IPv6 example code in it shouldnt trap, but it still did). If I comment out the 'InitializeStack()' function it doesnt crash, so its definitely a network issue of some sort.

Full detail of the trap:
Exception Frame/A7 = 20007cbc
Trap Vector = Access Error (2)
Format = 04
Status register SR = 2000
Fault Status = 0c
Faulted PC = 02052206

I would appreciate any advice
User avatar
TomNB
Posts: 541
Joined: Tue May 10, 2016 8:22 am

Re: TCP/IP stack trapping

Post by TomNB »

Have you changed any of the netburner system files or default settings? If you have a brand new sb70lc, and build an unmodified netburner example, I would expect it to work. There are two possibilities that come to mind:

1. Something in the tool chain has been modified. Since you seem to be trying to write your own stack, that seems to be a possibility. The quickest test I can think of for that would be to rename your current \nburn directory to save it, do a clean install of the tools, and build the ipv6 example.

2. Are you powering the device any differently? When the network is enabled there will be a bigger power draw, and if there isn't enough power available, the device behavior could be anything.

The trap message shows an access error, which is usually when a program is trying to access an area of memory that is not in the memory map. This could occur for either of the above situations.
User avatar
TomNB
Posts: 541
Joined: Tue May 10, 2016 8:22 am

Re: TCP/IP stack trapping

Post by TomNB »

A side question: The current stack is already dual IPv4/v6. What does the stack you are trying to make do differently?
romanluba
Posts: 12
Joined: Mon Oct 26, 2020 6:03 am

Re: TCP/IP stack trapping

Post by romanluba »

I am not trying to rebuild the stack or build my own, just trying to use the given one/make it work. I am creating my own code using examples and materials from netburner libraries. As I mentioned, it very closely resembled the Multi socket TCP server example. I'm using the dual IPv4/v6 functionality (commented out #define IPV4ONLY).
User avatar
TomNB
Posts: 541
Joined: Tue May 10, 2016 8:22 am

Re: TCP/IP stack trapping

Post by TomNB »

Did you see the previous post about the tools installation? Have you tried that yet?
romanluba
Posts: 12
Joined: Mon Oct 26, 2020 6:03 am

Re: TCP/IP stack trapping

Post by romanluba »

Commenting on this since this issue has not been resolved yet. I have attempted to install my software for TCP using IPv4ONLY and it works like a charm, however when I try to use the simplest IPv6 Example on dual stack (specifically using IPv6 - DHCPv6 example) and connect it to our corporate network, it traps out with an Access Error (2).

I was using ShowAllv6Info() to monitor the actions and it seems like it is not receiving DHCP information since its at STATE_REQUEST_PENDING prior to the trap.
I'll attempt to step through the code once I resolve a gdb issue.

I can now use Addr2Line thank to your help, and according to the trap information this is where it points me:

Exception frame = 200070ec (IP_VAR_SECT_END)
Faulted PC = 0201a71e (IPV6_NEIGHBOR::ShowItem())

The last task that ran was Enet #26 | Fifo

with the following trace back
02004146 - OS_FIFO::Pend(os_fifo_el volatile**, unsigned long)
C:\nburn\system/ucos.cpp:774

02023430 - OSFifoPend(OS_FIFO*, unsigned short)
C:\nburn/include/ucos.h:725

0201b84c - NB::V6::DHCPv6::DHCPClient::SendRenewRebind(bool)
C:\nburn\system/ipv6/ipv6_dhcp.cpp:886

Has anyone ran into a similar issue?
User avatar
TomNB
Posts: 541
Joined: Tue May 10, 2016 8:22 am

Re: TCP/IP stack trapping

Post by TomNB »

I have not seen anything like that before. Without IPv4ONLY, all the examples are dual stack v4/v6. How about trying C:\nburn\examples\StandardStack\IPv6\IPv6-ShowAddress. That will display both 4v and v6 addresses. I am also attaching an application image of that example. Can you load it onto your device with autoupdate and let me know if there are any issues? If not, then try building that same example on your system and see if the behavior is identical. Look at the serial output to verify you can see both v4 and v6 addresses.
Attachments
ShowInterfaces_APP.zip
(192.75 KiB) Downloaded 169 times
romanluba
Posts: 12
Joined: Mon Oct 26, 2020 6:03 am

Re: TCP/IP stack trapping

Post by romanluba »

Hello, I have tried that application as well and it provides the same trap. I have found out that our network is stateless (SLAAC instead of DHCPv6), so the netburner only received a prefix. We have been performing network packet captures. One of my fears is that the network stack is not large enough, do you recommend any header settings that I should change besides ipv4 to ipv6 in predef.h?

Also, is it problematic to use a TCP socket with a Stateless network for the netburner?
User avatar
TomNB
Posts: 541
Joined: Tue May 10, 2016 8:22 am

Re: TCP/IP stack trapping

Post by TomNB »

Hi Roman,

Just to double check, when you say: " I have tried that application as well ", you mean you ran the .s19 app I sent you, correct?
User avatar
pbreed
Posts: 1081
Joined: Thu Apr 24, 2008 3:58 pm

Re: TCP/IP stack trapping

Post by pbreed »

Stateless is actually just fine.
It should cause no problems and TCP over stateless IPV6 should just work.
You should not have to change anything in predef.h

Please provide the trap address when running the exact example provided by Tom a few entries ago...
Post Reply