Nucleo L496ZG (BBE)

Overview

This is a set of Bridle’s board extensions (BBE) to the original Zephyr upstream board Nucleo L496ZG with some adaptions and improvement on Twister, Kconfig and Devicetree level.

List of extensions

Board YAML

  • add the missing features that this board supports and that Twister tests might depends on:

    • arduino_serial

Kconfig

  • activate self powered USB explicitly and set the maximum of electrical current consumption to 0㎃:

    ST Nucleo L496ZG

    Kconfig.defconfig
    config CDC_ACM_SERIAL_SELF_POWERED
    	default y
    	depends on USB_DEVICE_STACK_NEXT && USBD_CDC_ACM_CLASS
    
    config CDC_ACM_SERIAL_MAX_POWER
    	default 0 if BOARD_NUCLEO_L496ZG	# 0mA (self powered)
    	depends on USB_DEVICE_STACK_NEXT && USBD_CDC_ACM_CLASS
    
  • change log level only in case of use the native USB device port st,stm32-otgfs with CDC-ACM UART zephyr,cdc-acm-uart as Zephyr console:

    ST Nucleo L496ZG

    Kconfig.defconfig
    # Workaround for not being able to have commas in macro arguments
    DT_CHOSEN_Z_CONSOLE := zephyr,console
    DT_COMPAT_Z_CDC_ACM_UART := zephyr,cdc-acm-uart
    DT_COMPAT_STM32_USB := st,stm32-otgfs
    
    # Macros to shorten Kconfig expressions
    DT_CHOSEN_CONSOLE_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_CONSOLE))
    DT_CHOSEN_CONSOLE_PARENT := $(dt_node_parent,$(DT_CHOSEN_CONSOLE_NODE))
    
    if BOARD_NUCLEO_L496ZG && \
    	$(dt_chosen_enabled,$(DT_CHOSEN_Z_CONSOLE)) && \
    	$(dt_compat_on_bus,$(DT_COMPAT_Z_CDC_ACM_UART),usb) && \
    	$(dt_node_has_compat,$(DT_CHOSEN_CONSOLE_PARENT),$(DT_COMPAT_STM32_USB))
    
    # Logger cannot use itself to log
    choice USBD_CDC_ACM_LOG_LEVEL_CHOICE
    	default USBD_CDC_ACM_LOG_LEVEL_OFF
    	depends on LOG && USB_DEVICE_STACK_NEXT && USBD_CDC_ACM_CLASS
    endchoice
    
    # Set USB log level to error only
    choice USBD_LOG_LEVEL_CHOICE
    	default USBD_LOG_LEVEL_ERR
    	depends on LOG && USB_DEVICE_STACK_NEXT && USBD_CDC_ACM_CLASS
    endchoice
    
    # Set UDC driver log level to error only
    choice UDC_DRIVER_LOG_LEVEL_CHOICE
    	default UDC_DRIVER_LOG_LEVEL_ERR
    	depends on LOG && USB_DEVICE_STACK_NEXT && USBD_CDC_ACM_CLASS
    endchoice
    
    endif # zephyr,cdc-acm-uart
    

Devicetree

  • set default entries for model and compatible of the boards:

    ST Nucleo L496ZG

    nucleo_l496zg_bbe.dts
    / {
    	model = "STMicroelectronics STM32L496ZG-NUCLEO board @ UART Concole (BBE)";
    	compatible = "st,stm32l496zg-nucleo",
    		     "st,stm32l496zg-nucleo-bbe",
    		     "st,stm32l496zg-nucleo-uartcons",
    		     "st,stm32l496zg-nucleo-uartcons-bbe";
    
    };
    
  • fix the wrong Arduino UNO R3 specific interface labels:

    • arduino_serial: &usart3 {};

Note

On Nucleo L496ZG pin D0 (RX) and D1 (TX) are connected to USART3 and not to LPUART1 as set in the origin upstream Devicetree. For more details, see schematic MB1312-A03 on sheet 5 and manual UM2179 table 11 on page 40.