Closed shijogeorge24 closed 7 months ago
There is something wrong with your configuration, it is failing in the debugassertions like nxmutex_is_hold:
bool nxmutex_is_hold(FAR mutex_t *mutex) { return mutex->holder == _SCHED_GETTID(); }
Basically it is checking if the mutex is hold by the Task ID of your task running the example.
@hartmannathan since you use TIVA board and probably already tested CAN, do you have some idea what could be happening?
@acassis I use Tiva but my boards don't use the CAN interfaces so I haven't used the CAN driver. The first thing to check is what code is supposed to hold the mutex and why it isn't. Improper initialization?
Here is my .config file config.txt
example using https://github.com/apache/nuttx-apps/blob/master/examples/can/can_main.c
@shijogeorge24 thanks for confirming it worked, I will close this issue now.
Please don't forget to submit the tm4c123g-launchpad:can board profile to mainline to help other people using CAN on TIVA board
sure
having issue with can driver for tiva c 123gxl board example used provided in the example from apps
tm4cbringup:
int tm4c_can_setup(void) { int ret = ERROR;
// struct can_dev_s *devst;
//# ifdef CONFIG_TIVA_CAN0 tiva_can0_enableclk();
ret = tiva_configgpio(GPIO_CAN0_RX); if (ret < 0) { goto configgpio_error; }
ret = tiva_configgpio(GPIO_CAN0_TX); if (ret < 0) { // snerr("error init gpio rx can \n"); goto configgpio_error; }
/* Call tiva_can_initialize() to get an instance of CAN interface 0
and register it. */
ret = tiva_can_initialize("/dev/can0", 0); if (ret < 0) { canerr("ERROR: Failed to get/register CAN interface 0\n"); return ret; }
return OK;
configgpio_error: canerr("ERROR: failed to configure CAN GPIO pin.\n"); return ret; }
nsh> ? help usage: help [-v] []
Builtin Apps: can nsh sh
nsh> can -n 1
nmsgs: 1 min ID: can_open: ocount: 0 _assert: Current Version: NuttX 12.2.1 148c631a2d Feb 24 2024 16:41:10 arm _assert: Assertion failed nxmutex_is_hold(mutex): at file: misc/lib_mutex.c:339 task: 0xe7b9 up_dump_register: R0: 20000d20 R1: 00000153 R2: 000122af R3: 20000830 up_dump_register: R4: 20000d20 R5: 20005db8 R6: 20000780 FP: 000122c6 up_dump_register: R8: 000122af SB: 00000153 SL: 00016241 R11: 00016298 up_dump_register: IP: 00000020 SP: 20006730 LR: 000016a7 PC: 000016a7 up_dump_register: xPSR: 60000000 PRIMASK: 00000001 CONTROL: 00000000 up_dump_register: EXC_RETURN: ffffffff dump_stack: User Stack: dump_stack: base: 0x200061a0 dump_stack: size: 00001992 dump_stack: sp: 0x20006730 stack_dump: 0x20006720: 20005db8 00000000 200002d0 000017f3 00000000 00000153 0000e7b9 200067c1 stack_dump: 0x20006740: 00000003 7474754e 00000058 0000235d 20001378 20001378 000000e8 20006820 stack_dump: 0x20006760: 20006820 000027bd ffffffff 000052bf 00000000 00004f83 2e323100 00312e32 stack_dump: 0x20006780: 20006998 00002167 20006ab8 34310000 33366338 64326131 62654620 20343220 stack_dump: 0x200067a0: 34323032 3a363120 313a3134 00000030 20006998 00000005 0000012c 0000245b stack_dump: 0x200067c0: 6d726100 0000fa00 00000006 0000235d 00000000 00000000 40040020 20000280 stack_dump: 0x200067e0: 20000240 2000012c 00000037 20000280 00007fff 00016241 00016298 00004ebf stack_dump: 0x20006800: fffffffb 0000502d 00000003 0001038b 20006820 0000000a 00000123 00000100 stack_dump: 0x20006820: 00015e11 00000000 000f4240 00030306 00000000 2000012c 200068b8 20000138 stack_dump: 0x20006840: 00000000 00010d11 00000000 200068b8 20005ac0 00000003 00000000 00007fff stack_dump: 0x20006860: 00016241 0000b989 32303437 0001630c 20005ac0 00000000 20001e70 0001630c stack_dump: 0x20006880: 00000000 00000700 20006168 00016303 20005db8 00000003 200068f8 00000000 stack_dump: 0x200068a0: 000007ff 0000b9cb 200068f8 000050d7 20005fb8 0000f633 00000003 00000000 stack_dump: 0x200068c0: 20005ac0 00000000 00005c55 00016303 00000003 20006180 00000003 0000ba51 stack_dump: 0x200068e0: 00016303 200068f8 00000000 00000001 0000e8e1 00000003 00007fff 00000001 stack_dump: 0x20006900: e3a7f334 00000001 000f4240 ce030306 01810001 f378bb6b 4d2a5b0b 20006968 stack_dump: 0x20006920: 00000000 00000000 00000000 0000e7b9 00000003 20006180 00000000 00000000 stack_dump: 0x20006940: 00000000 00000000 00000000 000051ef 00000000 00002853 00000000 00000000 1 max ID: 2047
if i comment this line // nxmutex_unlock(&canmod->thd_iface_lock); from static int tivacan_setup(struct can_dev_s *dev)
now the error changed nsh> can -n 1
nmsgs: 1
min ID: can_open: ocount: 0
tivacan_setup: tiva_can co_steup
can_ioctl: cmd: 6914 arg: 536897800
1 max Ican_write: buflen: 4
can_xmit: xmit head: 0 queue: 0 tail: 1
can_txdone: xmit head: 0 queue: 1 tail: 1
can_xmit: xmit head: 1 queue: 1 tail: 1
can_receive: ID: 44 DLC: 8
can_receive: ID: 44 DLC: 8
can_receive: ID: 44 DLC: 8
can_receive: ID: 44 DLC: 8
Dcan_receive: ID: 44 DLC: 8
ccan_receive: ID: 44 DLC: 8
acan_receive: ID: 44 DLC: 8
ncan_receive: ID: 44 DLC: 8
can_receive: ID: 44 DLC: 8
_can_receive: ID: 44 DLC: 8
_assert: Current Version: NuttX 12.2.1 148c631a2d Feb 24 2024 15:55:18 arm
_assert: Assertion failed curr: at file: wdog/wd_cancel.c:95 task: 0xe7b9
up_dump_register: R0: 20000d20 R1: 0000005f R2: 00011896 R3: 20000838
up_dump_register: R4: 20000d20 R5: 20005db8 R6: 20000780 FP: 0001189b
up_dump_register: R8: 00011896 SB: 0000005f SL: 0000fde1 R11: 00000000
up_dump_register: IP: 00000008 SP: 20000290 LR: 000016a7 PC: 000016a7
up_dump_register: xPSR: 20000037 PRIMASK: 00000001 CONTROL: 00000000
up_dump_register: EXC_RETURN: ffffffff
dump_stacks: ERROR: Stack pointer is not within the stack
dump_stack: IRQ Stack:
dump_stack: base: 0x200002d0
dump_stack: size: 00000300
stack_dump: 0x200002c0: 00000008 0000fde1 00000000 0000546b 200002f0 00015bf8 2e323100 00312e32
dump_stack: User Stack:
dump_stack: base: 0x200061a0
dump_stack: size: 00001992
dump_tasks: PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACKBASE STACKSIZE COMMAND
dump_tasks: ---- --- --- -------- ------- --- ------- ---------- -------- 0x2