Thank you Jared! I tried to increase the stack size, but I will get a crash. The call is made from a msg_controller().
static void **msg_controller** (const struct device *local_dev_tty2)
{
//tty2 is not used (remove)
struct socketcan_frame from_can_tx;
struct socketcan_frame from_can_rx;
while (true ) {
k_sleep(K_SECONDS(1));
...
uart_poll_out(local_dev_tty2, 'A'); // <<------- causes a BUS FAULT
k_sleep(K_SECONDS(1));
...
k_msgq_get(&incoming_msgq, &from_can_rx, K_NO_WAIT); <---- this call does not cause a crash
...
k_sleep(K_SECONDS(1));
}
}
The thread was created this way:
msg_ctrl_tid = k_thread_create(&msg_ctrl_data, msg_ctrl_stack,
K_THREAD_STACK_SIZEOF(msg_ctrl_stack)+10,
(k_thread_entry_t)**msg_controller,** NULL,
NULL, NULL, PRIORITY, 0, K_NO_WAIT); // tty2 is for UART to get
00:00:04.007,000] <err> os: ***** BUS FAULT *****
[00:00:04.007,000] <err> os: Precise data bus error
[00:00:04.007,000] <err> os: BFAR Address: 0x2feecd12
[00:00:04.008,000] <err> os: r0/a1: 0x00000000 r1/a2: 0x6000c071 r2/a3: 0x00000000
[00:00:04.008,000] <err> os: r3/a4: 0x2feecc96 r12/ip: 0x0000c350 r14/lr: 0x6000c027
[00:00:04.008,000] <err> os: xpsr: 0x61000000
[00:00:04.008,000] <err> os: Faulting instruction address (r15/pc): 0x600078d2
[00:00:04.008,000] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
[00:00:04.008,000] <err> os: Current thread: 0x80000300 (unknown)
[00:00:04.009,000] <err> os: Halting system