nrf9160dk_nrf9160 v0.9.0 mcp2515 canbus decoding problems (SPI is working)

This is the next step of the process getting the canbus working with nrf9160 and the aditional MKR CAN shield from arduino


previus part can be read here 

https://devzone.nordicsemi.com/f/nordic-q-a/81754/nrf9160dk_nrf9160-v0-9-0-v1-7-1-mcp2515-canbus-build-problems


As requested from the previus ticket i have checked the SPI bus and it seems to work.


This is the text on the terminal:

[00:00:00.201,599] <dbg> mcp2515_can.socket_can_init: Init socket CAN device 0x2a698 (SOCKET_CAN_1) for dev 0x2a6c8 (CAN_1)
[00:00:00.217,041] <dbg> net_core.net_init: (main): Priority 90
[00:00:00.225,646] <dbg> net_core.l3_init: (main): Network L3 init done
[00:00:00.234,954] <dbg> mcp2515_can.socket_can_iface_init: Init CAN interface 0x20014a08 dev 0x2a698
uart:~$ *** Booting Zephyr OS build v2.7.0-ncs1  ***
[00:00:00.251,403] <inf> net_socket_can_sample: sleeping for 5 seconds
[00:00:05.260,772] <dbg> net_ctx.net_context_bind: (main): Context 0x200154d8 binding to 1 iface[2] 0x20014a08
[00:00:05.273,559] <dbg> net_conn.conn_register_debug: (main): [0x20015974/1/4/0x05] remote -/0
[00:00:05.285,064] <dbg> net_conn.conn_register_debug: (main):   local ?/0 cb 0x17931 ud (nil)
[00:00:05.296,417] <dbg> net_sock_can.can_register_filters: (main): Registering 1 filters
[00:00:05.307,281] <dbg> net_sock_can.can_register_receiver: (main): Max 1 receivers
[00:00:05.317,840] <dbg> net_socket_can_sample.setup_socket: Started socket CAN TX thread
[00:00:05.328,704] <inf> net_socket_can_sample: 1st RX fd 0
[00:00:05.336,975] <inf> net_socket_can_sample: caaling rx command
[00:00:05.345,855] <dbg> net_socket_can_sample.rx: [0] Waiting CAN data...
[00:00:06.317,871] <dbg> net_socket_can_sample.tx: Sending CAN data...



Parents
  • Hello Tomas,

    T.B-D said:
    Where do i find the information for the values marked with ? bellow.

    you can check the bit timing values hereBut anyway, it doesn’t matter that much as long as they match with the values of the other devices connected to the CAN bus.

    T.B-D said:
    If above values is wrong , will i still be abel to inizialse as bellow ? 

    All other values should be ok. To verify, you could enable CONFIG_SPI_LOG_LEVEL_DBG and check if any warning or error messages from the SPI drivers appear in the log.

    T.B-D said:
    I reprogrammed my arduino to sending this information. But it did not come threw.

    Which are the ID’s of those CAN frames? It is a little bit hard for me to interpret this as I’m not familiar with the library. But I assume that

    CAN.beginPacket(0x1F4);
    CAN.beginPacket(0x1BCDEF);

    includes both the arbitration + control field?

    How does the physical setup of your CAN bus generally look like? Do you have a connection layout or similar?

    Regards,

    Markus

  • Hi coming back to this topic again...
    Now it seems that i getting something threw the the canbus connections. but it gives an stack owerflow as in the infornation bellow.

    The can transmitter is sending the following data:
    
    
    Received packet with id 0x2F4 and length 8
    A1 A2 A1 4B 45 6B 85 C3 
    
    Received packet with id 0x1 and length 8
    A1 A2 A1 4B 45 6B 85 C3 
    
    Received packet with id 0x2F4 and length 8
    A1 A2 A1 4B 45 6B 85 C3 
    
    Received packet with id 0x1 and length 8
    A1 A2 A1 4B 45 6B 85 C3 
    
    


    I reprogrammed my CAN Transmitter with an extension of 2 seconds and that gave the timedifferns of stack owerflow from the firts test to te second test of 2 seconds as in the log bellow.

    test with can transmitter 
    
    [00:00:00.730,194] <inf> net_socket_can_sample: sleeping for 1 seconds
    [00:00:01.739,593] <dbg> net_ctx.net_context_bind: (main): Context 0x200154d8 binding to 1 iface[2] 0x20014a08
    [00:00:01.752,380] <dbg> net_conn.conn_register_debug: (main): [0x20015974/1/4/0x05] remote -/0
    [00:00:01.763,885] <dbg> net_conn.conn_register_debug: (main):   local ?/0 cb 0x17969 ud (nil)
    [00:00:01.775,238] <dbg> net_sock_can.can_register_filters: (main): Registering 1 filters
    [00:00:01.786,132] <dbg> net_sock_can.can_register_receiver: (main): Max 1 receivers
    [00:00:01.796,661] <dbg> net_socket_can_sample.setup_socket: Started socket CAN TX thread
    [00:00:01.807,556] <inf> net_socket_can_sample: 1st RX fd 0
    [00:00:01.815,826] <inf> net_socket_can_sample: Started CAN application (0)
    [00:00:01.825,469] <inf> net_socket_can_sample: calling rx command
    [00:00:01.834,350] <dbg> net_socket_can_sample.rx: [0] Waiting CAN data...
    [00:00:02.796,722] <dbg> net_socket_can_sample.tx: Sending CAN data...
    [00:00:04.222,686] <err> os: ***** HARD FAULT *****
    [00:00:04.230,651] <err> os:   Fault escalation (see below)
    [00:00:04.239,166] <err> os: ***** USAGE FAULT *****
    [00:00:04.247,070] <err> os:   Stack overflow (context area not valid)
    [00:00:04.256,561] <err> os: r0/a1:  0x00000008  r1/a2:  0x00000000  r2/a3:  0x20017378
    [00:00:04.267,517] <err> os: r3/a4:  0x20017388 r12/ip:  0x007a1200 r14/lr:  0x000117f3
    [00:00:04.278,503] <err> os:  xpsr:  0x61000000
    [00:00:04.285,949] <err> os: Faulting instruction address (r15/pc): 0x00023802
    [00:00:04.296,142] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
    [00:00:04.306,335] <err> os: Current thread: 0x20014510 (unknown)
    [00:00:04.315,368] <err> fatal_error: Resetting system
    uart:~$ ooting Zephyr OS build v2.7.0-ncs1  ***
    Flash regions           Domain          Permissions
    00 01 0x00000 0x10000   Secure          rwxl
    02 31 0x10000 0x100000  Non-Secure      rwxl
    
    Non-secure callable region 0 placed in flash region 1 with size 32.
    
    SRAM region             Domain          Permissions
    00 07 0x00000 0x10000   Secure          rwxl
    08 31 0x10000 0x40000   Non-Secure      rwxl
    
    ***********************************************************************************************************************************
    reprogrammed can transmitter with 2 seconds longer time before sending 
    
    [00:00:00.729,980] <inf> net_socket_can_sample: sleeping for 1 seconds
    [00:00:01.739,349] <dbg> net_ctx.net_context_bind: (main): Context 0x200154d8 binding to 1 iface[2] 0x20014a08
    [00:00:01.752,136] <dbg> net_conn.conn_register_debug: (main): [0x20015974/1/4/0x05] remote -/0
    [00:00:01.763,641] <dbg> net_conn.conn_register_debug: (main):   local ?/0 cb 0x17969 ud (nil)
    [00:00:01.774,993] <dbg> net_sock_can.can_register_filters: (main): Registering 1 filters
    [00:00:01.785,888] <dbg> net_sock_can.can_register_receiver: (main): Max 1 receivers
    [00:00:01.796,417] <dbg> net_socket_can_sample.setup_socket: Started socket CAN TX thread
    [00:00:01.807,312] <inf> net_socket_can_sample: 1st RX fd 0
    [00:00:01.815,551] <inf> net_socket_can_sample: Started CAN application (0)
    [00:00:01.825,225] <inf> net_socket_can_sample: calling rx command
    [00:00:01.834,106] <dbg> net_socket_can_sample.rx: [0] Waiting CAN data...
    [00:00:02.796,447] <dbg> net_socket_can_sample.tx: Sending CAN data...
    [00:00:06.223,937] <err> os: ***** HARD FAULT *****
    [00:00:06.231,903] <err> os:   Fault escalation (see below)
    [00:00:06.240,386] <err> os: ***** USAGE FAULT *****
    [00:00:06.248,291] <err> os:   Stack overflow (context area not valid)
    [00:00:06.257,781] <err> os: r0/a1:  0x00000008  r1/a2:  0x00000000  r2/a3:  0x20017378
    [00:00:06.268,737] <err> os: r3/a4:  0x20017388 r12/ip:  0x007a1200 r14/lr:  0x000117f3
    [00:00:06.279,693] <err> os:  xpsr:  0x61000000
    [00:00:06.287,170] <err> os: Faulting instruction address (r15/pc): 0x00023802
    [00:00:06.297,332] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
    [00:00:06.307,525] <err> os: Current thread: 0x20014510 (unknown)
    [00:00:06.316,558] <err> fatal_error: Resetting system
    uart:~$ ooting Zephyr OS build v2.7.0-ncs1  ***
    Flash regions           Domain          Permissions
    00 01 0x00000 0x10000   Secure          rwxl
    02 31 0x10000 0x100000  Non-Secure      rwxl
    
    Non-secure callable region 0 placed in flash region 1 with size 32.
    
    SRAM region             Domain          Permissions
    00 07 0x00000 0x10000   Secure          rwxl
    08 31 0x10000 0x40000   Non-Secure      rwxl
     

Reply
  • Hi coming back to this topic again...
    Now it seems that i getting something threw the the canbus connections. but it gives an stack owerflow as in the infornation bellow.

    The can transmitter is sending the following data:
    
    
    Received packet with id 0x2F4 and length 8
    A1 A2 A1 4B 45 6B 85 C3 
    
    Received packet with id 0x1 and length 8
    A1 A2 A1 4B 45 6B 85 C3 
    
    Received packet with id 0x2F4 and length 8
    A1 A2 A1 4B 45 6B 85 C3 
    
    Received packet with id 0x1 and length 8
    A1 A2 A1 4B 45 6B 85 C3 
    
    


    I reprogrammed my CAN Transmitter with an extension of 2 seconds and that gave the timedifferns of stack owerflow from the firts test to te second test of 2 seconds as in the log bellow.

    test with can transmitter 
    
    [00:00:00.730,194] <inf> net_socket_can_sample: sleeping for 1 seconds
    [00:00:01.739,593] <dbg> net_ctx.net_context_bind: (main): Context 0x200154d8 binding to 1 iface[2] 0x20014a08
    [00:00:01.752,380] <dbg> net_conn.conn_register_debug: (main): [0x20015974/1/4/0x05] remote -/0
    [00:00:01.763,885] <dbg> net_conn.conn_register_debug: (main):   local ?/0 cb 0x17969 ud (nil)
    [00:00:01.775,238] <dbg> net_sock_can.can_register_filters: (main): Registering 1 filters
    [00:00:01.786,132] <dbg> net_sock_can.can_register_receiver: (main): Max 1 receivers
    [00:00:01.796,661] <dbg> net_socket_can_sample.setup_socket: Started socket CAN TX thread
    [00:00:01.807,556] <inf> net_socket_can_sample: 1st RX fd 0
    [00:00:01.815,826] <inf> net_socket_can_sample: Started CAN application (0)
    [00:00:01.825,469] <inf> net_socket_can_sample: calling rx command
    [00:00:01.834,350] <dbg> net_socket_can_sample.rx: [0] Waiting CAN data...
    [00:00:02.796,722] <dbg> net_socket_can_sample.tx: Sending CAN data...
    [00:00:04.222,686] <err> os: ***** HARD FAULT *****
    [00:00:04.230,651] <err> os:   Fault escalation (see below)
    [00:00:04.239,166] <err> os: ***** USAGE FAULT *****
    [00:00:04.247,070] <err> os:   Stack overflow (context area not valid)
    [00:00:04.256,561] <err> os: r0/a1:  0x00000008  r1/a2:  0x00000000  r2/a3:  0x20017378
    [00:00:04.267,517] <err> os: r3/a4:  0x20017388 r12/ip:  0x007a1200 r14/lr:  0x000117f3
    [00:00:04.278,503] <err> os:  xpsr:  0x61000000
    [00:00:04.285,949] <err> os: Faulting instruction address (r15/pc): 0x00023802
    [00:00:04.296,142] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
    [00:00:04.306,335] <err> os: Current thread: 0x20014510 (unknown)
    [00:00:04.315,368] <err> fatal_error: Resetting system
    uart:~$ ooting Zephyr OS build v2.7.0-ncs1  ***
    Flash regions           Domain          Permissions
    00 01 0x00000 0x10000   Secure          rwxl
    02 31 0x10000 0x100000  Non-Secure      rwxl
    
    Non-secure callable region 0 placed in flash region 1 with size 32.
    
    SRAM region             Domain          Permissions
    00 07 0x00000 0x10000   Secure          rwxl
    08 31 0x10000 0x40000   Non-Secure      rwxl
    
    ***********************************************************************************************************************************
    reprogrammed can transmitter with 2 seconds longer time before sending 
    
    [00:00:00.729,980] <inf> net_socket_can_sample: sleeping for 1 seconds
    [00:00:01.739,349] <dbg> net_ctx.net_context_bind: (main): Context 0x200154d8 binding to 1 iface[2] 0x20014a08
    [00:00:01.752,136] <dbg> net_conn.conn_register_debug: (main): [0x20015974/1/4/0x05] remote -/0
    [00:00:01.763,641] <dbg> net_conn.conn_register_debug: (main):   local ?/0 cb 0x17969 ud (nil)
    [00:00:01.774,993] <dbg> net_sock_can.can_register_filters: (main): Registering 1 filters
    [00:00:01.785,888] <dbg> net_sock_can.can_register_receiver: (main): Max 1 receivers
    [00:00:01.796,417] <dbg> net_socket_can_sample.setup_socket: Started socket CAN TX thread
    [00:00:01.807,312] <inf> net_socket_can_sample: 1st RX fd 0
    [00:00:01.815,551] <inf> net_socket_can_sample: Started CAN application (0)
    [00:00:01.825,225] <inf> net_socket_can_sample: calling rx command
    [00:00:01.834,106] <dbg> net_socket_can_sample.rx: [0] Waiting CAN data...
    [00:00:02.796,447] <dbg> net_socket_can_sample.tx: Sending CAN data...
    [00:00:06.223,937] <err> os: ***** HARD FAULT *****
    [00:00:06.231,903] <err> os:   Fault escalation (see below)
    [00:00:06.240,386] <err> os: ***** USAGE FAULT *****
    [00:00:06.248,291] <err> os:   Stack overflow (context area not valid)
    [00:00:06.257,781] <err> os: r0/a1:  0x00000008  r1/a2:  0x00000000  r2/a3:  0x20017378
    [00:00:06.268,737] <err> os: r3/a4:  0x20017388 r12/ip:  0x007a1200 r14/lr:  0x000117f3
    [00:00:06.279,693] <err> os:  xpsr:  0x61000000
    [00:00:06.287,170] <err> os: Faulting instruction address (r15/pc): 0x00023802
    [00:00:06.297,332] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
    [00:00:06.307,525] <err> os: Current thread: 0x20014510 (unknown)
    [00:00:06.316,558] <err> fatal_error: Resetting system
    uart:~$ ooting Zephyr OS build v2.7.0-ncs1  ***
    Flash regions           Domain          Permissions
    00 01 0x00000 0x10000   Secure          rwxl
    02 31 0x10000 0x100000  Non-Secure      rwxl
    
    Non-secure callable region 0 placed in flash region 1 with size 32.
    
    SRAM region             Domain          Permissions
    00 07 0x00000 0x10000   Secure          rwxl
    08 31 0x10000 0x40000   Non-Secure      rwxl
     

Children
No Data
Related