This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
I am trying to add MicroPython support for BeagleConnect Freedom. While doing this, I encountered an issue which I am not sure is a hardware limitation or some software problem is Zephyr.
To summarize, BeagleConnect Freedom hangs if 2 PWM and IEEE802154 subg networking is enabled together. Everything is okay if only 1 PWM pin is enabled. I can reproduce this outside of MicroPython as well, so it does not seem to be a specific issue to MicroPython.
# To Reproduce
Steps to reproduce the behavior:
I have also created a Zephyr issue .
I will also try to check if the same happens using TiRTOS as well, but I wanted to ask if this is a known limitation of hardware.
MB1 PWM: DIO 17
MB2 PWM: DIO 19
I am using GPTimer 0 for MB1 PWM and GPTimer 1 for MB2 PWM by default, but I also tried switching to gptimer2 and gptimer3 and got the same results.
Here is the design spec: https://docs.beagleboard.org/boards/beagleconnect/freedom/03-design.html#cc1352p7
I am using the normal upstream devicetree so here are the links:
- https://github.com/zephyrproject-rtos/zephyr/blob/main/boards/beagle/beagleconnect_freedom/beagleconnect_freedom.dts
- https://github.com/zephyrproject-rtos/zephyr/blob/main/boards/beagle/beagleconnect_freedom/beagleconnect_freedom-pinctrl.dtsi
Hi Ayush,
I have tested on the BeagleConnect with our "collector" example + the task from the "pwmled2" example, configured to use DIO17 and DIO19.
It all works as expected, no hang to be seen.
Do you have a way to run load the binary file generated by west into the CC1352P7 using CCS. That way, you could step through the code and see where it hangs.
Regards,
Arthur
I have a launchpad cc1352p1 with the xds110. I was also able to flash my bcf from CCS Theia connected over JTAG.
I am having some difficulties using openocd though. I am using the openocd config from cc1352p7_launchpad. Here is the output I get:
```
❯ west debug
-- west debug: rebuilding
ninja: no work to do.
-- west debug: using runner openocd
-- runners.openocd: OpenOCD GDB server running on port 3333; no thread info available
Open On-Chip Debugger 0.12.0+dev-00761-gd09ff4764 (2024-10-26-22:01)
Licensed under GNU GPL v2
For bug reports, read
openocd.org/.../bugs.html
cortex_m reset_config vectreset
DEPRECATED! use 'tcl port' not 'tcl_port'
DEPRECATED! use 'telnet port', not 'telnet_port'
DEPRECATED! use 'gdb port', not 'gdb_port'
GNU gdb (Zephyr SDK 0.16.5) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <gnu.org/.../gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arm-zephyr-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<github.com/.../issues>.
Find the GDB manual and other documentation resources online at:
<www.gnu.org/.../>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /var/home/ayush/Documents/Programming/BeagleBoard/beagleconnect_upstream/build/zephyr/zephyr.elf...
Info : XDS110: connected
Info : XDS110: vid/pid = 0451/bef3
Info : XDS110: firmware version = 3.0.0.32
Info : XDS110: hardware version = 0x0023
Info : XDS110: connected to target via JTAG
Info : XDS110: TCK set to 2500 kHz
Info : clock speed 5500 kHz
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: cc26x2x7.jrc: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : [cc26x2x7.cpu] starting gdb server on 3333
Info : Listening on port 3333 for gdb connections
TargetName Type Endian TapName State
-- ------------------ ---------- ------ ------------------ ------------
0* cc26x2x7.cpu cortex_m little cc26x2x7.cpu tap-disabled
Error: Target not examined yet
Remote debugging using :3333
Info : XDS110: disconnected
Remote communication error. Target disconnected.: Connection reset by peer.
You can't do that when your target is `exec'
(gdb) exit
```
Note: I am using openocd built from master which seems to contain the patches for cc1352p7.
Is there a way to maybe load and debug the Zephyr hex or elf or bin file from CCS Theia instead of going with openocd? I will also try to get openocd working in the time being.
Using Theia, in the "empty" project loaded from the SDK, you can press "Start Debugging":
which will then allow you to load an arbitrary binary file using the "Load" menu:
Wait a little bit, and the firmware should load. From there, you can issue a board reset:
Which will bring you to the beginning of a boot sequence.
Regards,
Arthur
Thanks for the instructions. I tried using it to walk the `echo_server` sample with `CONFIG_PWM=y` and well, I could not really understand where it hangs. The main function is executed in it's entirety so, the hang is probably happening either in a different thread, or something. Not really sure.
I also created an even minimal example to replicate it. Here is the prj.conf:
```
# nothing here
CONFIG_NETWORKING=y
CONFIG_NET_IPV4=n
CONFIG_NET_IPV6=y
CONFIG_NET_UDP=y
CONFIG_NET_TCP=y
CONFIG_NET_SOCKETS=y
CONFIG_ENTROPY_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y
# Network buffers
CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=64
CONFIG_NET_BUF_TX_COUNT=64
CONFIG_NET_CONTEXT_NET_PKT_POOL=y
CONFIG_BT=n
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_NEED_IPV6=y
CONFIG_NET_CONFIG_NEED_IPV4=n
CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1"
CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::2"
CONFIG_NET_CONFIG_MY_IPV4_ADDR=""
CONFIG_NET_L2_IEEE802154=y
CONFIG_NET_DHCPV4=n
CONFIG_NET_CONFIG_IEEE802154_CHANNEL=1
CONFIG_PWM=y
```
main.c:
```
#include <zephyr/kernel.h>
int main(void)
{
while(1) {
printk("Hello World!\n");
k_msleep(5000);
}
return 0;
}
```
This program does not even seem to reach the `main`.
Hi Ayush,
The fact that it does not reach the main is an important clue. It could somehow be the interrupt vectors that got corrupted.
When you pause the execution, do you see any Cpu exception, or anything that could indicate that?
Regards,
Arthur
Hi Arthur
First pause is here: https://github.com/zephyrproject-rtos/cmsis/blob/4b96cbb174678dcd3ca86e11e1f24bc5f8726da0/CMSIS/Core/Include/cmsis_gcc.h#L951
Here is the call stack:
```
__enable_irq() 0x00010C54cmsis_gcc.h951:3
arch_cpu_idle() 0x00010C54cpu_idle.c97:2
k_cpu_idle() 0x0000EBEAkernel.h5999:1
idle() 0x0000EBE6idle.c71:4
z_thread_entry() 0x0000119Akernel.h670:9
```
The second pause does not seem to be at any specific file. Here is the call stack:
```
__asm___11_driverlib_c_a91c79fe__CPUwfi + 0x2 () 0x1000060A
```
Any subsequent pause leads me to the same position, so this is probably the place of hang.
Regards,
Ayush Singh
Hi Ayush,
Thanks for the info, but what about the exception register?
Do you see any of thoses? (Table is from the technical reference manual)
Regards,
Arthur
Not sure what is going on, but your response regarding the CC1352P7 launchpad is not showing up here. The reson the `hello_world` minimal example I created works on launchpad works is because the base devicetree for launchpad does not enable pwm. So enabling `CONFIG_PWM=y` has no real effect.
Hi Ayush,
It seems like this is the case indeed. By the way, stepping through the driver initialization in Zephyr (ieee, and PWM) does not show any error there as well.
Regards,
Arthur
No, just tried the latest Zephyr but same result.
I have been a bit busy with some other stuff to try fixing this myself.
Ok, So I found the position where freeze occurs: github.com/.../policy_state_lock.c
This is called by https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/pwm/pwm_cc13xx_cc26xx_timer.c#L66
Need to investigate a bit more to fix the problem (just commenting it out works but probably not a solution).