1:name: Zephyr BLE HCI-UART on nRF52840 2:description: Two pairs of machines (host-controller) communicating through BLE. Hosts and controllers communicate using HCI-UART. Every machine is running Zephyr on nRF52840. 3 4emulation CreateUARTHub "central_hci" 5emulation CreateUARTHub "peripheral_hci" 6emulation CreateBLEMedium "wireless" 7 8using sysbus 9 10$central_bin?=@https://dl.antmicro.com/projects/renode/nrf52840dk--zephyr-ble_central_hr_hci_uart.elf-s_3302344-e0d303c14ad52fda2b16157c09ce62f1d065bc31 11$peripheral_bin?=@https://dl.antmicro.com/projects/renode/nrf52840dk--zephyr-ble_peripheral_hr_hci_uart.elf-s_3094464-d15ff2ff7cf4ba4105b1896b445b5e4baeb7a487 12$hci_uart_bin?=@https://dl.antmicro.com/projects/renode/nrf52840dk--zephyr-ble_hci_uart.elf-s_2437336-4bf9cccb70ca95fb12667896eec3f777f39f90ee 13 14# Create central machines 15mach create "central_host" 16machine LoadPlatformDescription @platforms/boards/nrf52840dk_nrf52840.repl 17connector Connect sysbus.uart1 central_hci 18showAnalyzer uart0 19 20mach create "central_controller" 21machine LoadPlatformDescription @platforms/boards/nrf52840dk_nrf52840.repl 22connector Connect sysbus.radio wireless 23connector Connect sysbus.uart1 central_hci 24 25# Create peripheral machines 26mach create "peripheral_host" 27machine LoadPlatformDescription @platforms/boards/nrf52840dk_nrf52840.repl 28connector Connect sysbus.uart1 peripheral_hci 29showAnalyzer uart0 30 31mach create "peripheral_controller" 32machine LoadPlatformDescription @platforms/boards/nrf52840dk_nrf52840.repl 33connector Connect sysbus.radio wireless 34connector Connect sysbus.uart1 peripheral_hci 35 36# Set Quantum value for CPUs. This is required by BLE stack 37# as it results in more often synchronization between machines. 38emulation SetGlobalQuantum "0.00001" 39 40macro reset 41""" 42 mach set "central_host" 43 sysbus LoadELF $central_bin 44 cpu IsHalted true 45 46 mach set "peripheral_host" 47 sysbus LoadELF $peripheral_bin 48 cpu IsHalted true 49 50 mach set "central_controller" 51 sysbus LoadELF $hci_uart_bin 52 53 mach set "peripheral_controller" 54 sysbus LoadELF $hci_uart_bin 55 56 # Controllers need to be started earlier as they need time to configure UART devices for reception. 57 # Hosts begin UART transmission early so without the delay the initial part of the communication would be dropped. 58 emulation RunFor "1" 59 60 mach set "central_host" 61 cpu IsHalted false 62 63 mach set "peripheral_host" 64 cpu IsHalted false 65""" 66runMacro $reset 67