jared52005 / Monitor

Logging CAN, KLINE and ISO15765, TP2.0 directly into Wireshark and parsing UDS and KWP2000 data
MIT License
20 stars 4 forks source link

ESP32-S3 Crash on transmitting TCP packet #1

Closed jared52005 closed 11 months ago

jared52005 commented 1 year ago

Every time when I will try to transmit from KLINE via TCP (IP RAW layer), then LWIP appears to crash on ECU response of 1A9B. First I was experiencing this:

W (29068) Passive_Kline.c: ISO14230 crap bytes:  
I (29068) Passive_Kline.c: 0x3fc9eca0   00 00 00 00 00 00 00 00  00 00 00 00 00 55 ef 8f  |.............U..|
I (29068) Passive_Kline.c: 0x3fc9ecb0   8f 8f 8f 00 00 00                                 |......| 
Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled. 

Core  1 register dump: 
PC      : 0x40382165  PS      : 0x00060e33  A0      : 0x80382b0c  A1      : 0x3fce1ad0
A2      : 0x3fcf0014  A3      : 0x9704cd80  A4      : 0x00000280  A5      : 0x3fc9fea9   
A6      : 0x000005a0  A7      : 0xfffffffc  A8      : 0x3fcf7334  A9      : 0x3fcf7348
A10     : 0x00000003  A11     : 0xfffffffc  A12     : 0x3fcf7350  A13     : 0x3fcf733c   
A14     : 0x57355a48  A15     : 0xfffffffc  SAR     : 0x0000001c  EXCCAUSE: 0x0000001d   
EXCVADDR: 0x9704cd80  LBEG    : 0x40056f5c  LEND    : 0x40056f72  LCOUNT  : 0x00000000

Backtrace:0x40382162:0x3fce1ad00x40382b09:0x3fce1af0 0x40375ce1:0x3fce1b10 0x40375d09:0x3fce1b30 0x40375d35:0x3fce1b50 0x4038343d:0x3fce1b70 0x42018bbc:0x3fce1b90 0x42018c3b:0x3fce1bb0 0x42018ca9:0x3fce1bd0 0x4201e535:0x3fce1bf0 0x4201eb06:0x3fce1c20 0x4202a43a:0x3fce1c90 0x4202b17c:0x3fce1cb0 0x42017fd5:0x3fce1cd0 0x42018078:0x3fce1cf0 0x4037fc35:0x3fce1d20  

Then after I have increased memory of tcpwsraw_thread from 4096 to 8192 bytes, error has changed on

----

E (23908) Task_Tcp_Wireshark_Raw.c: Error occurred during sending: errno 5 
W (23908) Task_Tcp_Wireshark_Raw.c: Socket closed

assert failed: lwip_netconn_do_delconn IDF/components/lwip/lwip/src/api/api_msg.c:1161 (netconn state error) 

Backtrace:0x40375b8e:0x3fce1b500x4037c9f1:0x3fce1b70 0x4038342d:0x3fce1b90 0x4202ac13:0x3fce1cb0 0x42017fd5:0x3fce1cd0 0x42018078:0x3fce1cf0 0x4037fc35:0x3fce1d20

I am not sure what exactly is a cause. It might be related to length of a TCP packet. I will need to better pinpoint it and see if it is the issue on ISO15765 and VWTP2.0 and on older ESP32

jared52005 commented 11 months ago

pvPortMalloc(sizeof(length)) allocating only 4 bytes for a whole frame instead of allocating length amount of bytes