Szymon, thanks! That sounds really promising. Looking forward to it. Not sure if RTT is going to work with my OpenOCD/CMSIS-DAP debugger but for now I can use gdb when UART is disabled.
Will, I think I managed to pinpoint the place where my app fails once the UART_0 is disabled. Below is my app's syscfg.yml: syscfg.vals: # Setup PINs UART_0: 0 I2C_0: 1 # DEBUG logging is a bit noisy; use INFO. LOG_LEVEL: 255 # Default task settings OS_MAIN_STACK_SIZE: 336 # BLE settings BLE_MAX_CONNECTIONS: 4 # Hardware-accelerated float arithmetics HARDFLOAT: 0 # Log reboot messages to a flash circular buffer. REBOOT_LOG_FCB: 0 LOG_FCB: 0 CONFIG_FCB: 0 # Enable newtmgr commands. STATS_NEWTMGR: 0 LOG_NEWTMGR: 0 # Enable Config. CONFIG_NEWTMGR: 0 And then there's the code that tried to use uart_blocking_tx, below is my gdb session's log: Breakpoint 2, hal_bsp_init () at repos/apache-mynewt-core/hw/bsp/rb-nano2/src/hal_bsp.c:184 184 assert(rc == 0); (gdb) p rc $4 = 0 (gdb) c Continuing. Error: nrf52.cpu -- clearing lockup after double fault nrf52.cpu -- clearing lockup after double fault Polling target nrf52.cpu failed, trying to reexamine Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints Program received signal SIGINT, Interrupt. 0x00001bdc in ?? () (gdb) bt #0 0x00001bdc in ?? () #1 0x0001cb56 in uart_blocking_tx (byte=<optimized out>, dev=<optimized out>) at repos/apache-mynewt-core/hw/drivers/uart/include/uart/uart.h:140 #2 console_blocking_tx (ch=<optimized out>) at repos/apache-mynewt-core/sys/console/full/src/cons_tty.c:226 #3 0x0001ce0a in console_file_write (arg=<optimized out>, str=0x2000ff07 "0", cnt=1) at repos/apache-mynewt-core/sys/console/full/src/cons_tty.c:286 #4 0x0000ad3a in fwrite (stream=0x243dc <console_file>, nmemb=1, size=1, buf=0x2000ff07) at repos/apache-mynewt-core/libc/baselibc/include/stdio.h:59 #5 fputc (f=0x243dc <console_file>, c=<optimized out>) at repos/apache-mynewt-core/libc/baselibc/include/stdio.h:75 #6 putf (putp=putp@entry=0x243dc <console_file>, c=<optimized out>) at repos/apache-mynewt-core/libc/baselibc/src/tinyprintf.c:135 #7 0x0000ae68 in putchw (putp=putp@entry=0x243dc <console_file>, p=p@entry =0x2000ff48) at repos/apache-mynewt-core/libc/baselibc/src/tinyprintf.c:185 #8 0x0000b036 in tfp_format (putp=putp@entry=0x243dc <console_file>, fmt=0x243e3 ":", fmt@entry=0xd "\001", va=...) at repos/apache-mynewt-core/libc/baselibc/src/tinyprintf.c:286 #9 0x0000b186 in vfprintf (va=..., fmt=0xd "\001", f=0x243dc <console_file>) at repos/apache-mynewt-core/libc/baselibc/src/tinyprintf.c:338 #10 fprintf (f=f@entry=0x243dc <console_file>, fmt=0x243e0 "%lu:") at repos/apache-mynewt-core/libc/baselibc/src/tinyprintf.c:345 #11 0x0001cb10 in console_printf (fmt=0x23cd8 "Unhandled interrupt (%ld), exception sp 0x%08lx\n") at repos/apache-mynewt-core/sys/console/full/src/cons_fmt.c:48 #12 0x00008ee6 in os_default_irq (tf=0x2000ffc0) at repos/apache-mynewt-core/kernel/os/src/arch/cortex_m4/os_fault.c:152 #13 0x0000a9f2 in os_default_irq_asm () at repos/apache-mynewt-core/kernel/os/src/arch/cortex_m4/m4/HAL_CM4.s:223 #14 <signal handler called> #15 0x00000000 in ?? () #16 0x000082ca in SystemInit () at repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/system_nrf52.c:312 #17 0x00000000 in ?? () (gdb) c <--- from this point on my app won't recover Continuing. Error: nrf52.cpu -- clearing lockup after double fault nrf52.cpu -- clearing lockup after double fault Polling target nrf52.cpu failed, trying to reexamine Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints Program received signal SIGINT, Interrupt. 0x00001bdc in ?? () (gdb) Unfortunately I don't know what caused the original interrupt that triggered dumping data to the console. On Mon, Apr 10, 2017 at 3:41 PM, will sanfilippo <wi...@runtime.io> wrote: > Just an FYI: I was playing around with some code for something I was > working on and I was able to disable UART0 although I did not try to > re-purpose the pins. The UART was certainly not enabled did not attempt to > grab the gpio. This was using the nrf52dk bsp though. > > Anyway, I think it worth a bit of effort to try and figure out exactly > what happened in your case Lukasz. > > > On Apr 10, 2017, at 1:04 AM, Szymon Janc <szymon.j...@codecoup.pl> > wrote: > > > > Hi, > > > > On Sunday, 9 April 2017 21:47:26 CEST Łukasz Wolnik wrote: > > > > <snip> > > > >> Later I found out that my pull-up resistors were actually 100 Ohms > instead > >> of 10k. So actually above change to the drive wasn't necessary (it > should > >> stay as GPIO_PIN_CNF_DRIVE_S0D1) but I have to say that fixing hardware > >> issues using software feels good. Besides RedBear Nano2 has it's own > >> pull-ups so no resistors are required in the first place. > >> > >> And just for completeness, I have tried different setups to share the > lines > >> with UART_0 (pins 2, 28, 29 and 30) but none of them worked. So my > previous > >> try with the Bluetooth serial logging must have been sabotaged by the > 100 > >> Ohm pull-up resistors. I have a feeling that it's not so easy to disable > >> UART_0 completely so your advice to change SPI0_CONFIG_SCK_PIN pin might > >> have been necessary as well. Luckily there's no need to checking it. > > > > Just a heads up, but Michał was working on adding RTT console support for > > Mynewt and with those patches it should be possible to disable UART_0 > ie. we > > are able to use console over RTT while using UART for HCI monitoring > (other > > feature we are working on). Currently this is pending review and PR > should be > > updated in upcoming days. > > > > Code is available at > > https://github.com/michal-narajowski/incubator-mynewt-core/tree/bletiny2 > > > > -- > > pozdrawiam > > Szymon Janc > >