I want to use the cli (Adapter -> Launch Console) on a custom hardware based on the EFR32MG21 chipset. It will be using a ZNet stack and will be developed with the GNU ARM toolchain.
What is the minimal HAL periferial definitions needed to make this happen? The documents say that it uses the Virtual UART over the SWD pins (SWDIO, SWDCLK), but how do I set this up correctly? I also need a SPI-configured UART for another peripherial (different pins).
The devkit radio board HAL config uses USART0 as application serial communication, and USART 0 is set up using PA04-06 and PC01. Are these pins also needed? It also sets up a Virtual COM Port with VCOM enable on PD04. Is that needed? This config also does not define a Virtual UART, but the console still works..!?
Any help appreciated. Thanks.
I don't get this. This states:
Virtual UART is a feature that allows a serial UART interface to be emulated over the debug connector ordinarily used for programming and SerialWire debugging. On the EFR32MG, it makes use of SerialWire's SWO line for output and SerialWire's SWDIO (along with the ARM Cortex's ITM channel 8) for input.
If that is correct I apparently need SWO in addition to the SWD pins. It does not mention any other pins..?
It also states:
Set Application Serial Port to 0 and enable Virtual UART Port 0 with non-zero serial queue sizes.
Is that a setting in the hardware configurator or is it to be done in application software?
Your dev radio board sounds like it is using USART 0 to implement the CLI. When you Adapter->Launce Console you are actually opening a terminal program. You can also use Tera Term or Hyperterminal as an alternative. If you where using the SWO, then you would click Adapter ->Open SWO Terminal.
The best place to start is the user guide and schematic for your dev board and see how that is wired.
Virtual comport and Virtual UART are different things. The Virtual UART is the SWDIO connection on the debugger as you state, and virtual COM port is the USB to USART interface on the dev board. When using the Virtual COM port, you needs to enabled this from the firmware.
Which ports and pins the app uses are configured in the configurator.
The bare minimum you need for a USART CLI is RX and TX if you are not using flow control
I have been using VCOM for debug printing for a while now, but due to changes in hardware I need to switch to using VUART and SWO. I have tried to set this up according to HAL Fundamentals and https://www.silabs.com/community/wireless/zigbee-and-thread/knowledge-base.entry.html/2016/09/01/tips_on_using_virtua-S5qH, but I have so far been unable to make it work.
GPIO is enabled as required (note that USART0 is enabled for other purposes, not for debug printing - is this a problem?):
// $[GPIO] #define PORTIO_GPIO_SWCLK_PIN (1U) #define PORTIO_GPIO_SWCLK_PORT (gpioPortA) #define PORTIO_GPIO_SWDIO_PIN (2U) #define PORTIO_GPIO_SWDIO_PORT (gpioPortA) #define PORTIO_GPIO_SWV_PIN (3U) #define PORTIO_GPIO_SWV_PORT (gpioPortA) #define BSP_TRACE_SWO_PIN (3U) #define BSP_TRACE_SWO_PORT (gpioPortA) // [GPIO]$ // $[SERIAL] #define BSP_SERIAL_APP_PORT (HAL_SERIAL_PORT_VUART) #define BSP_SERIAL_ASSERT_PORT (HAL_SERIAL_PORT_VUART) #define HAL_SERIAL_RXWAKE_ENABLE (0) #define HAL_SERIAL_IDLE_WAKE_ENABLE (1) #define HAL_SERIAL_USART0_ENABLE (0) #define HAL_SERIAL_USART1_ENABLE (0) #define HAL_SERIAL_USART2_ENABLE (0) #define HAL_SERIAL_APP_TYPE (HAL_VUART_TYPE_SWO) #define HAL_SERIAL_ASSERT_TYPE (HAL_VUART_TYPE_SWO) // [SERIAL]$ // $[VUART] #define HAL_SERIAL_VUART_ENABLE (1) #define HAL_VUART_TYPE (HAL_VUART_TYPE_SWO) // [VUART]$ // $[USART0] #define PORTIO_USART0_RX_PIN (6U) #define PORTIO_USART0_RX_PORT (gpioPortA) #define PORTIO_USART0_TX_PIN (5U) #define PORTIO_USART0_TX_PORT (gpioPortA) #define HAL_USART0_ENABLE (1) #define BSP_USART0_TX_PIN (5U) #define BSP_USART0_TX_PORT (gpioPortA) #define BSP_USART0_RX_PIN (6U) #define BSP_USART0_RX_PORT (gpioPortA) #define HAL_USART0_BAUD_RATE (115200UL) #define HAL_USART0_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_NONE) #define HAL_USART0_RXSTOP (16UL) #define HAL_USART0_RXSTART (16UL) #define HAL_USART0_TX_QUEUE_SIZE (128UL) #define HAL_USART0_RX_QUEUE_SIZE (128UL) // [USART0]$ #define EMBER_SERIAL0_MODE EMBER_SERIAL_FIFO
I am using emberAfCorePrintln() or emberAfAppPrintln() methods for printing.
When I Launch Console I am unable to see any printing in the SERIAL0 (or SERIAL1). If I press enter in the SERIAL0 tab I get an error message (the device is connected and powered): E[35008406h]: Target connection error. Check target connection and restart kit.
I can load and debug the device, and debug printing previously worked with the VCOM interface. SWO pin is connected to the debug interface (MINI connector). The device is using EmberZnet 22.214.171.124 (v.2.6.4). I assume I am missing some software initialization? Any help appreciated.
Also, is connection of the VMCU pin to the MINI debug connector required?