zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.48k stars 6.41k forks source link

BLE Testing functions do not work properly #42534

Closed piotrParf closed 2 years ago

piotrParf commented 2 years ago

I am using Nordic nRF5340DK with Zephyr 2.7.0 LTS SDK. I am using built in j-link and SES(Segger Embedded Studio) to debug. I also use emptyapp from nordic on the application core and example HCI uart from /samples/bluetooth/hci_uart and set CONFIG_BT_CTLR_DTM_HCI=y in prj.conf

I am using nrf testing applications like RSSI Viewer and DTM test demos on Windows and code for nRF5340DK is being build in linux Debian enviroment.

The issue: When I use HCI command LE Transmitter Test the test packets stop transmitting after certain time or packet count(around ~4000). I cant find any workaround to this issue, yet it is needed for Bluetooth hardware testing. The DTM sample app from nRF Connect SDK works as expected but they are not compatible with Bluetooth stack.

To Reproduce Build an Empty Application Core from Nordic, to give control for network core, from their repository. https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/nrf5340/empty_app_core/README.html

Build an HCI-UART application with setting: CONFIG_BT_CTLR_DTM_HCI=y

1.Run SES and load HCI-UART example application to the network core, 2.load empty application core to the network core, 3.connect the UART of nrf5340 to rtt-uart output of NRF5340DK to proceed with attaching HCI-BLE to linux

  1. On linux(debian in my case) run as su : btattach -B /dev/ttyACM1 -S 1000000 -P h4 &
  2. now open the RSSI Viewer application on another Nordic developement kit and start it to watch the BLE radio spectrum.
  3. now on the linux run the hci tool and send command: hcitool -i hci1 cmd 0x08 0x1e 0x02 0x20 0x00 0x00 (HCI_LE_Transmitter_Test [v2] from specification BLE 5.2 Vol 4, Part E) It should start sending packets with PRBS9 at channel 2 with length of 32 bytes, until issuance of the command hcitool -i hci1 cmd 0x08 0x1f (LE_Test_End)

Expected behavior The Bluetooth stack should transmit test packets continuously until receiving LE_Test_End command from HCI interface, yet it spontaneously stops transmitting sooner than the command LE_Test_End.

Additional info The same issue happens when in network core app directly is being called ll_test_tx() function from subsys/bluetooth/controller/ll_sw/nordic/lll/lll_test.c - the packets suddenly stop transmitting after some time.

cvinayak commented 2 years ago

Since you are using a linux distribution, ensure that Bluetooth Daemon is disabled, i.e. bluetoothd is not running. Do upload the full HCI logs using hcidump tool for futher analysis of the issue.

Also, there are some work in progress related to Direct Test Mode support in Zephyr, please follow https://github.com/zephyrproject-rtos/zephyr/pull/42300

carlescufi commented 2 years ago

@piotrParf can you please enclose a full btmon trace of the sequence please?

piotrParf commented 2 years ago

I see nothing specia at btmon at the moment. Will investigate tomorrow. Up to today it looks like this.

>Bluetooth monitor ver 5.55
>= Note: Linux version 5.10.0-9-amd64 (x86_64)                                            0.496297
>= Note: Bluetooth subsystem version 2.22                                                 0.496298`
>@ MGMT Open: bluetoothd (privileged) version 1.18                               {0x0001} 0.496299
>= New Index: 00:00:00:00:00:00 (Primary,UART,hci0)                               [hci0] 13.425551
>= Open Index: 00:00:00:00:00:00                                                  [hci0] 13.425587
>< HCI Command: Reset (0x03|0x0003) plen 0                                     #1 [hci0] 13.425785
> HCI Event: Command Complete (0x0e) plen 4                                   #2 [hci0] 13.427845
      Reset (0x03|0x0003) ncmd 1
        Status: Success (0x00)
< HCI Command: Read Local Supported Features (0x04|0x0003) plen 0             #3 [hci0] 13.431066
> HCI Event: Command Complete (0x0e) plen 12                                  #4 [hci0] 13.433043
      Read Local Supported Features (0x04|0x0003) ncmd 1
        Status: Success (0x00)
        Features: 0x00 0x00 0x00 0x00 0x60 0x00 0x00 0x00
          BR/EDR Not Supported
          LE Supported (Controller)
< HCI Command: Read Local Version Information (0x04|0x0001) plen 0            #5 [hci0] 13.433112
> HCI Event: Command Complete (0x0e) plen 12                                  #6 [hci0] 13.433958
      Read Local Version Information (0x04|0x0001) ncmd 1
        Status: Success (0x00)
        HCI version: Reserved (0x0c) - Revision 0 (0x0000)
        LMP version: Reserved (0x0c) - Subversion 65535 (0xffff)
        Manufacturer: The Linux Foundation (1521)
< HCI Command: Read BD ADDR (0x04|0x0009) plen 0                              #7 [hci0] 13.434044
> HCI Event: Command Complete (0x0e) plen 10                                  #8 [hci0] 13.434933
      Read BD ADDR (0x04|0x0009) ncmd 1
        Status: Success (0x00)
        Address: 00:00:00:00:00:00 (OUI 00-00-00)
< HCI Command: LE Read Buffer Size (0x08|0x0002) plen 0                       #9 [hci0] 13.435092
> HCI Event: Command Complete (0x0e) plen 7                                  #10 [hci0] 13.435819
      LE Read Buffer Size (0x08|0x0002) ncmd 1
        Status: Success (0x00)
        Data packet length: 27
        Num data packets: 7
< HCI Command: LE Read Local Supported Features (0x08|0x0003) plen 0         #11 [hci0] 13.435866
> HCI Event: Command Complete (0x0e) plen 12                                 #12 [hci0] 13.436787
      LE Read Local Supported Features (0x08|0x0003) ncmd 1
        Status: Success (0x00)
        Features: 0xff 0x49 0x01 0x00 0x00 0x00 0x00 0x00
          LE Encryption
          Connection Parameter Request Procedure
          Extended Reject Indication
          Slave-initiated Features Exchange
          LE Ping
          LE Data Packet Length Extension
          LL Privacy
          Extended Scanner Filter Policies
          LE 2M PHY
          LE Coded PHY
          Channel Selection Algorithm #2
          Minimum Number of Used Channels Procedure
< HCI Command: LE Read Supported States (0x08|0x001c) plen 0                 #13 [hci0] 13.436859
> HCI Event: Command Complete (0x0e) plen 12                                 #14 [hci0] 13.437731
      LE Read Supported States (0x08|0x001c) ncmd 1
        Status: Success (0x00)
        States: 0x000003ffff3fffff
          Non-connectable Advertising State
          Scannable Advertising State
          Connectable Advertising State
          High Duty Cycle Directed Advertising State
          Passive Scanning State
          Active Scanning State
          Initiating State
            and Connection State (Master Role)
          Connection State (Slave Role)
          Non-connectable Advertising State
            and Passive Scanning State
          Scannable Advertising State
            and Passive Scanning State
          Connectable Advertising State
            and Passive Scanning State
          High Duty Cycle Directed Advertising State
            and Passive Scanning State
          Non-connectable Advertising State
            and Active Scanning State
          Scannable Advertising State
            and Active Scanning State
          Connectable Advertising State
            and Active Scanning State
          High Duty Cycle Directed Advertising State
            and Active Scanning State
          Non-connectable Advertising State
            and Initiating State
          Scannable Advertising State
            and Initiating State
          Non-connectable Advertising State
            and Connection State (Master Role)
          Scannable Advertising State
            and Connection State (Master Role)
          Non-connectable Advertising State
            and Connection State (Slave Role)
          Scannable Advertising State
            and Connection State (Slave Role)
          Passive Scanning State
            and Connection State (Master Role)
          Active Scanning State
            and Connection State (Master Role)
          Passive Scanning State
            and Connection State (Slave Role)
          Active Scanning State
            and Connection State (Slave Role)
          Initiating State
            and Connection State (Master Role)
            and Master Role & Master Role
          Low Duty Cycle Directed Advertising State
          Low Duty Cycle Directed Advertising State
            and Passive Scanning State
          Low Duty Cycle Directed Advertising State
            and Active Scanning State
          Connectable Advertising State
            and Initiating State
            and Master Role & Slave Role
          High Duty Cycle Directed Advertising State
            and Initiating State
            and Master Role & Slave Role
          Low Duty Cycle Directed Advertising State
            and Initiating State
            and Master Role & Slave Role
          Connectable Advertising State
            and Connection State (Master Role)
            and Master Role & Slave Role
          High Duty Cycle Directed Advertising State
            and Connection State (Master Role)
            and Master Role & Slave Role
          Low Duty Cycle Directed Advertising State
            and Connection State (Master Role)
            and Master Role & Slave Role
          Connectable Advertising State
            and Connection State (Slave Role)
            and Master Role & Slave Role
          High Duty Cycle Directed Advertising State
            and Connection State (Slave Role)
            and Slave Role & Slave Role
          Low Duty Cycle Directed Advertising State
            and Connection State (Slave Role)
            and Slave Role & Slave Role
          Initiating State
            and Connection State (Slave Role)
            and Master Role & Slave Role
< HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0            #15 [hci0] 13.437792
> HCI Event: Command Complete (0x0e) plen 68                                 #16 [hci0] 13.439083
      Read Local Supported Commands (0x04|0x0002) ncmd 1
        Status: Success (0x00)
        Commands: 66 entries
          Disconnect (Octet 0 - Bit 5)
          Read Remote Version Information (Octet 2 - Bit 7)
          Set Event Mask (Octet 5 - Bit 6)
          Reset (Octet 5 - Bit 7)
          Read Transmit Power Level (Octet 10 - Bit 2)
          Set Controller To Host Flow Control (Octet 10 - Bit 5)
          Host Buffer Size (Octet 10 - Bit 6)
          Host Number of Completed Packets (Octet 10 - Bit 7)
          Read Local Version Information (Octet 14 - Bit 3)
          Read Local Supported Features (Octet 14 - Bit 5)
          Read BD ADDR (Octet 15 - Bit 1)
          Read RSSI (Octet 15 - Bit 5)
          Set Event Mask Page 2 (Octet 22 - Bit 2)
          LE Set Event Mask (Octet 25 - Bit 0)
          LE Read Buffer Size (Octet 25 - Bit 1)
          LE Read Local Supported Features (Octet 25 - Bit 2)
          LE Set Random Address (Octet 25 - Bit 4)
          LE Set Advertising Parameters (Octet 25 - Bit 5)
          LE Read Advertising Channel TX Power (Octet 25 - Bit 6)
          LE Set Advertising Data (Octet 25 - Bit 7)
          LE Set Scan Response Data (Octet 26 - Bit 0)
          LE Set Advertise Enable (Octet 26 - Bit 1)
          LE Set Scan Parameters (Octet 26 - Bit 2)
          LE Set Scan Enable (Octet 26 - Bit 3)
          LE Create Connection (Octet 26 - Bit 4)
          LE Create Connection Cancel (Octet 26 - Bit 5)
          LE Read White List Size (Octet 26 - Bit 6)
          LE Clear White List (Octet 26 - Bit 7)
          LE Add Device To White List (Octet 27 - Bit 0)
          LE Remove Device From White List (Octet 27 - Bit 1)
          LE Connection Update (Octet 27 - Bit 2)
          LE Set Host Channel Classification (Octet 27 - Bit 3)
          LE Read Channel Map (Octet 27 - Bit 4)
          LE Read Remote Used Features (Octet 27 - Bit 5)
          LE Encrypt (Octet 27 - Bit 6)
          LE Rand (Octet 27 - Bit 7)
          LE Start Encryption (Octet 28 - Bit 0)
          LE Long Term Key Request Reply (Octet 28 - Bit 1)
          LE Long Term Key Request Neg Reply (Octet 28 - Bit 2)
          LE Read Supported States (Octet 28 - Bit 3)
          LE Receiver Test (Octet 28 - Bit 4)
          LE Transmitter Test (Octet 28 - Bit 5)
          LE Test End (Octet 28 - Bit 6)
          Read Authenticated Payload Timeout (Octet 32 - Bit 4)
          Write Authenticated Payload Timeout (Octet 32 - Bit 5)
          LE Remote Connection Parameter Request Reply (Octet 33 - Bit 4)
          LE Remote Connection Parameter Request Negative Reply (Octet 33 - Bit 5)
          LE Set Data Length (Octet 33 - Bit 6)
          LE Read Suggested Default Data Length (Octet 33 - Bit 7)
          LE Write Suggested Default Data Length (Octet 34 - Bit 0)
          LE Add Device To Resolving List (Octet 34 - Bit 3)
          LE Remove Device From Resolving List (Octet 34 - Bit 4)
          LE Clear Resolving List (Octet 34 - Bit 5)
          LE Read Resolving List Size (Octet 34 - Bit 6)
          LE Read Peer Resolvable Address (Octet 34 - Bit 7)
          LE Read Local Resolvable Address (Octet 35 - Bit 0)
          LE Set Address Resolution Enable (Octet 35 - Bit 1)
          LE Set Resolvable Private Address Timeout (Octet 35 - Bit 2)
          LE Read Maximum Data Length (Octet 35 - Bit 3)
          LE Read PHY (Octet 35 - Bit 4)
          LE Set Default PHY (Octet 35 - Bit 5)
          LE Set PHY (Octet 35 - Bit 6)
          LE Enhanced Receiver Test (Octet 35 - Bit 7)
          LE Enhanced Transmitter Test (Octet 36 - Bit 0)
          LE Read Transmit Power (Octet 38 - Bit 7)
          LE Set Privacy Mode (Octet 39 - Bit 2)
< HCI Command: Set Event Mask (0x03|0x0001) plen 8                           #17 [hci0] 13.439232
        Mask: 0x200080000204e890
          Disconnection Complete
          Encryption Change
          Read Remote Version Information Complete
          Command Complete
          Command Status
          Hardware Error
          Number of Completed Packets
          Data Buffer Overflow
          Encryption Key Refresh Complete
          LE Meta
> HCI Event: Command Complete (0x0e) plen 4                                  #18 [hci0] 13.440642
      Set Event Mask (0x03|0x0001) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Event Mask (0x08|0x0001) plen 8                        #19 [hci0] 13.440688
        Mask: 0x0000000000080e7f
          LE Connection Complete
          LE Advertising Report
          LE Connection Update Complete
          LE Read Remote Used Features Complete
          LE Long Term Key Request
          LE Remote Connection Parameter Request
          LE Data Length Change
          LE Enhanced Connection Complete
          LE Direct Advertising Report
          LE PHY Update Complete
          LE Channel Selection Algorithm
> HCI Event: Command Complete (0x0e) plen 4                                  #20 [hci0] 13.441611
      LE Set Event Mask (0x08|0x0001) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Read Advertising Channel TX Power (0x08|0x0007) plen 0     #21 [hci0] 13.441676
> HCI Event: Command Complete (0x0e) plen 5                                  #22 [hci0] 13.442657
      LE Read Advertising Channel TX Power (0x08|0x0007) ncmd 1
        Status: Success (0x00)
        TX power: 0 dbm (0x00)
< HCI Command: LE Read White List Size (0x08|0x000f) plen 0                  #23 [hci0] 13.442706
> HCI Event: Command Complete (0x0e) plen 5                                  #24 [hci0] 13.443621
      LE Read White List Size (0x08|0x000f) ncmd 1
        Status: Success (0x00)
        Size: 8
< HCI Command: LE Clear White List (0x08|0x0010) plen 0                      #25 [hci0] 13.443669
> HCI Event: Command Complete (0x0e) plen 4                                  #26 [hci0] 13.444632
      LE Clear White List (0x08|0x0010) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Read Resolving List Size (0x08|0x002a) plen 0              #27 [hci0] 13.444690
> HCI Event: Command Complete (0x0e) plen 5                                  #28 [hci0] 13.445607
      LE Read Resolving List Size (0x08|0x002a) ncmd 1
        Status: Success (0x00)
        Size: 8
< HCI Command: LE Clear Resolving List (0x08|0x0029) plen 0                  #29 [hci0] 13.445670
> HCI Event: Command Complete (0x0e) plen 4                                  #30 [hci0] 13.446603
      LE Clear Resolving List (0x08|0x0029) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Resolvable Private Address Tim.. (0x08|0x002e) plen 2  #31 [hci0] 13.446642
        Timeout: 900 seconds
> HCI Event: Command Complete (0x0e) plen 4                                  #32 [hci0] 13.447548
      LE Set Resolvable Private Address Timeout (0x08|0x002e) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Read Maximum Data Length (0x08|0x002f) plen 0              #33 [hci0] 13.447593
> HCI Event: Command Complete (0x0e) plen 12                                 #34 [hci0] 13.448733
      LE Read Maximum Data Length (0x08|0x002f) ncmd 1
        Status: Success (0x00)
        Max TX octets: 27
        Max TX time: 2704
        Max RX octets: 27
        Max RX time: 2704
< HCI Command: LE Read Suggested Default Data Length (0x08|0x0023) plen 0    #35 [hci0] 13.448760
> HCI Event: Command Complete (0x0e) plen 8                                  #36 [hci0] 13.449595
      LE Read Suggested Default Data Length (0x08|0x0023) ncmd 1
        Status: Success (0x00)
        TX octets: 27
        TX time: 328
< HCI Command: Set Event Mask Page 2 (0x03|0x0063) plen 8                    #37 [hci0] 13.449722
        Mask: 0x0000000000800000
          Authenticated Payload Timeout Expired
> HCI Event: Command Complete (0x0e) plen 4                                  #38 [hci0] 13.450641
      Set Event Mask Page 2 (0x03|0x0063) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Write Suggested Default Data Length (0x08|0x0024) plen 4   #39 [hci0] 13.450720
        TX octets: 27
        TX time: 2704
> HCI Event: Command Complete (0x0e) plen 4                                  #40 [hci0] 13.451630
      LE Write Suggested Default Data Length (0x08|0x0024) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Default PHY (0x08|0x0031) plen 3                       #41 [hci0] 13.451655
        All PHYs preference: 0x00
        TX PHYs preference: 0x01
          LE 1M
        RX PHYs preference: 0x01
          LE 1M
> HCI Event: Command Complete (0x0e) plen 4                                  #42 [hci0] 13.452720
      LE Set Default PHY (0x08|0x0031) ncmd 1
        Status: Success (0x00)
= Index Info: 00:00:00:00:00:00 (The Linux Foundation)                           [hci0] 13.452933
= Close Index: 00:00:00:00:00:00                                                 [hci0] 13.452942
@ MGMT Event: Index Added (0x0004) plen 0                               {0x0001} [hci0] 13.452943
@ MGMT Command: Read Controller Information (0x0004) plen 0             {0x0001} [hci0] 13.453023
@ MGMT Event: Command Complete (0x0001) plen 283                        {0x0001} [hci0] 13.453031
      Read Controller Information (0x0004) plen 280
        Status: Success (0x00)
        Address: 00:00:00:00:00:00 (OUI 00-00-00)
        Version: Reserved (0x0c)
        Manufacturer: The Linux Foundation (1521)
        Supported settings: 0x0001be1b
          Powered
          Connectable
          Discoverable
          Bondable
          Low Energy
          Advertising
          Secure Connections
          Debug Keys
          Privacy
          Static Address
          PHY Configuration
        Current settings: 0x00000200
          Low Energy
        Class: 0x000000
          Major class: Miscellaneous
          Minor class: 0x00
        Name: 
        Short name: 
= bluetoothd: profiles/sap/server.c:sap_server_register() Sap driver initialization..   13.454349
= bluetoothd: sap-server: Operation not permitted (1)                            [hci0] 13.454357
@ MGMT Command: Remove UUID (0x0011) plen 16                            {0x0001} [hci0] 13.454398
        UUID: 00000000-0000-0000-0000-000000000000
@ MGMT Event: Command Complete (0x0001) plen 6                          {0x0001} [hci0] 13.454405
      Remove UUID (0x0011) plen 3
        Status: Success (0x00)
        Class: 0x000000
          Major class: Miscellaneous
          Minor class: 0x00
@ MGMT Command: Remove Device (0x0034) plen 7                           {0x0001} [hci0] 13.454415
        BR/EDR Address: 00:00:00:00:00:00 (OUI 00-00-00)
@ MGMT Event: Command Complete (0x0001) plen 10                         {0x0001} [hci0] 13.454419
      Remove Device (0x0034) plen 7
        Status: Success (0x00)
        BR/EDR Address: 00:00:00:00:00:00 (OUI 00-00-00)
@ MGMT Command: Set Static Address (0x002b) plen 6                      {0x0001} [hci0] 13.454427
        Address: E0:42:E1:83:86:FF (Static)
@ MGMT Event: Command Complete (0x0001) plen 7                          {0x0001} [hci0] 13.454428
      Set Static Address (0x002b) plen 4
        Status: Success (0x00)
        Current settings: 0x00008200
          Low Energy
          Static Address
@ MGMT Command: Set Secure Connections (0x002d) plen 1                  {0x0001} [hci0] 13.454436
        Secure Connections: Enabled (0x01)
@ MGMT Event: Command Complete (0x0001) plen 7                          {0x0001} [hci0] 13.454437
      Set Secure Connections (0x002d) plen 4
        Status: Success (0x00)
        Current settings: 0x00008a00
          Low Energy
          Secure Connections
          Static Address
@ MGMT Command: Set Privacy (0x002f) plen 17                            {0x0001} [hci0] 13.454444
        Privacy: Disabled (0x00)
        Key: 00000000000000000000000000000000
@ MGMT Event: Command Complete (0x0001) plen 7                          {0x0001} [hci0] 13.454445
      Set Privacy (0x002f) plen 4
        Status: Success (0x00)
        Current settings: 0x00008a00
          Low Energy
          Secure Connections
          Static Address
@ MGMT Command: Read Experimental Features Information (0x0049) plen 0  {0x0001} [hci0] 13.454452
@ MGMT Event: Command Complete (0x0001) plen 45                         {0x0001} [hci0] 13.454454
      Read Experimental Features Information (0x0049) plen 42
        Status: Success (0x00)
        Features: 2
        UUID: 671b10b5-42c0-4696-9227-eb28d1b049d6
        Flags: 0x00000000
        UUID: 15c0a148-c273-11ea-b3de-0242ac130004
        Flags: 0x00000002
          Settings change
@ MGMT Command: Add UUID (0x0010) plen 17                               {0x0001} [hci0] 13.454461
        UUID: 00001800-0000-1000-8000-00805f9b34fb
        Service class: 0x00
@ MGMT Event: Command Complete (0x0001) plen 6                          {0x0001} [hci0] 13.454462
      Add UUID (0x0010) plen 3
        Status: Success (0x00)
        Class: 0x000000
          Major class: Miscellaneous
          Minor class: 0x00
@ MGMT Command: Add UUID (0x0010) plen 17                               {0x0001} [hci0] 13.454471
        UUID: 00001801-0000-1000-8000-00805f9b34fb
        Service class: 0x00
@ MGMT Event: Command Complete (0x0001) plen 6                          {0x0001} [hci0] 13.454472
      Add UUID (0x0010) plen 3
        Status: Success (0x00)
        Class: 0x000000
          Major class: Miscellaneous
          Minor class: 0x00
@ MGMT Command: Add UUID (0x0010) plen 17                               {0x0001} [hci0] 13.454479
        UUID: 0000180a-0000-1000-8000-00805f9b34fb
        Service class: 0x00
@ MGMT Event: Command Complete (0x0001) plen 6                          {0x0001} [hci0] 13.454480
      Add UUID (0x0010) plen 3
        Status: Success (0x00)
        Class: 0x000000
          Major class: Miscellaneous
          Minor class: 0x00
@ MGMT Command: Read Advertising Features (0x003d) plen 0               {0x0001} [hci0] 13.454487
@ MGMT Event: Command Complete (0x0001) plen 11                         {0x0001} [hci0] 13.454489
      Read Advertising Features (0x003d) plen 8
        Status: Success (0x00)
        Flags: 0x0000007f
          Switch into Connectable mode
          Advertise as Discoverable
          Advertise as Limited Discoverable
          Add Flags field to Advertising Data
          Add TX Power field to Advertising Data
          Add Appearance field to Scan Response
          Add Local Name in Scan Response
        Advertising data length: 31
        Scan response length: 31
        Max instances: 5
        Instances: 0
@ MGMT Command: Set Powered (0x0005) plen 1                             {0x0001} [hci0] 13.454496
        Powered: Enabled (0x01)
@ MGMT Event: Command Status (0x0002) plen 3                            {0x0001} [hci0] 13.454535
      Set Powered (0x0005)
        Status: RFKilled (0x12)
= bluetoothd: Failed to set mode: Blocked through rfkill (0x12)                  [hci0] 13.454577
@ MGMT Command: Set Local Name (0x000f) plen 260                        {0x0001} [hci0] 13.454568
        Name: core-firmware
        Short name: 
@ MGMT Event: Command Complete (0x0001) plen 263                        {0x0001} [hci0] 13.454569
      Set Local Name (0x000f) plen 260
        Status: Success (0x00)
        Name: core-firmware
        Short name: 
@ MGMT Command: Add UUID (0x0010) plen 17                               {0x0001} [hci0] 13.454580
        UUID: 0000110e-0000-1000-8000-00805f9b34fb
        Service class: 0x00
@ MGMT Event: Command Complete (0x0001) plen 6                          {0x0001} [hci0] 13.454581
      Add UUID (0x0010) plen 3
        Status: Success (0x00)
        Class: 0x000000
          Major class: Miscellaneous
          Minor class: 0x00
@ MGMT Command: Add UUID (0x0010) plen 17                               {0x0001} [hci0] 13.454590
        UUID: 0000110c-0000-1000-8000-00805f9b34fb
        Service class: 0x00
@ MGMT Event: Command Complete (0x0001) plen 6                          {0x0001} [hci0] 13.454591
      Add UUID (0x0010) plen 3
        Status: Success (0x00)
        Class: 0x000000
          Major class: Miscellaneous
          Minor class: 0x00
@ MGMT Command: Add UUID (0x0010) plen 17                               {0x0001} [hci0] 13.454599
        UUID: 0000111e-0000-1000-8000-00805f9b34fb
        Service class: 0x20
@ MGMT Event: Command Complete (0x0001) plen 6                          {0x0001} [hci0] 13.454600
      Add UUID (0x0010) plen 3
        Status: Success (0x00)
        Class: 0x000000
          Major class: Miscellaneous
          Minor class: 0x00
@ MGMT Command: Unblock Device (0x0027) plen 7                          {0x0001} [hci0] 13.454607
        BR/EDR Address: 00:00:00:00:00:00 (OUI 00-00-00)
@ MGMT Event: Command Complete (0x0001) plen 10                         {0x0001} [hci0] 13.454609
      Unblock Device (0x0027) plen 7
        Status: Success (0x00)
        BR/EDR Address: 00:00:00:00:00:00 (OUI 00-00-00)
@ MGMT Command: Load Long Term Keys (0x0013) plen 2                     {0x0001} [hci0] 13.454615
        Keys: 0
@ MGMT Event: Command Complete (0x0001) plen 3                          {0x0001} [hci0] 13.454616
      Load Long Term Keys (0x0013) plen 0
        Status: Success (0x00)
@ MGMT Command: Load Identity Resolving Keys (0x0030) plen 2            {0x0001} [hci0] 13.454623
        Keys: 0
@ MGMT Event: Command Complete (0x0001) plen 3                          {0x0001} [hci0] 13.454624
      Load Identity Resolving Keys (0x0030) plen 0
        Status: Success (0x00)
@ MGMT Command: Load Connection Parameters (0x0035) plen 2              {0x0001} [hci0] 13.454631
        Parameters: 0
@ MGMT Event: Command Complete (0x0001) plen 3                          {0x0001} [hci0] 13.454633
      Load Connection Parameters (0x0035) plen 0
        Status: Success (0x00)
@ MGMT Command: Add UUID (0x0010) plen 17                               {0x0001} [hci0] 13.454639
        UUID: 00001200-0000-1000-8000-00805f9b34fb
        Service class: 0x00
@ MGMT Event: Command Complete (0x0001) plen 6                          {0x0001} [hci0] 13.454640
      Add UUID (0x0010) plen 3
        Status: Success (0x00)
        Class: 0x000000
          Major class: Miscellaneous
          Minor class: 0x00
@ MGMT Command: Set Device ID (0x0028) plen 8                           {0x0001} [hci0] 13.454648
        Device ID: USB Implementer's Forum assigned (0x0002)
          Vendor: Linux Foundation (0x1d6b)
          Product: 0x0246
          Version: 5.3.7 (0x0537)
@ MGMT Event: Command Complete (0x0001) plen 3                          {0x0001} [hci0] 13.454649
      Set Device ID (0x0028) plen 0
        Status: Success (0x00)
@ MGMT Command: Set Local Name (0x000f) plen 260                        {0x0001} [hci0] 13.454655
        Name: core-firmware
        Short name: 
@ MGMT Event: Command Complete (0x0001) plen 263                        {0x0001} [hci0] 13.454656
      Set Local Name (0x000f) plen 260
        Status: Success (0x00)
        Name: core-firmware
        Short name: 
@ MGMT Command: Unknown (0x0046) plen 36                                {0x0001} [hci0] 13.454663
        02 00 01 bf 01 fb 9d 4e f3 bc 36 d8 74 f5 39 41  .......N..6.t.9A
        38 68 4c 02 a5 99 ba e4 e1 7c a6 18 22 8e 07 56  8hL......|.."..V
        b4 e8 5f 01                                      .._.            
@ MGMT Event: Command Complete (0x0001) plen 3                          {0x0001} [hci0] 13.454664
      Unknown (0x0046) plen 0
        Status: Success (0x00)
@ MGMT Command: Set Powered (0x0005) plen 1                             {0x0001} [hci0] 13.457014
        Powered: Enabled (0x01)
= Open Index: 00:00:00:00:00:00                                                  [hci0] 13.457038
< HCI Command: Reset (0x03|0x0003) plen 0                                    #43 [hci0] 13.457078
> HCI Event: Command Complete (0x0e) plen 4                                  #44 [hci0] 13.458652
      Reset (0x03|0x0003) ncmd 1
        Status: Success (0x00)
< HCI Command: Read Local Supported Features (0x04|0x0003) plen 0            #45 [hci0] 13.458718
> HCI Event: Command Complete (0x0e) plen 12                                 #46 [hci0] 13.459622
      Read Local Supported Features (0x04|0x0003) ncmd 1
        Status: Success (0x00)
        Features: 0x00 0x00 0x00 0x00 0x60 0x00 0x00 0x00
          BR/EDR Not Supported
          LE Supported (Controller)
< HCI Command: Read Local Version Information (0x04|0x0001) plen 0           #47 [hci0] 13.459695
> HCI Event: Command Complete (0x0e) plen 12                                 #48 [hci0] 13.460620
      Read Local Version Information (0x04|0x0001) ncmd 1
        Status: Success (0x00)
        HCI version: Reserved (0x0c) - Revision 0 (0x0000)
        LMP version: Reserved (0x0c) - Subversion 65535 (0xffff)
        Manufacturer: The Linux Foundation (1521)
< HCI Command: Read BD ADDR (0x04|0x0009) plen 0                             #49 [hci0] 13.460679
> HCI Event: Command Complete (0x0e) plen 10                                 #50 [hci0] 13.461566
      Read BD ADDR (0x04|0x0009) ncmd 1
        Status: Success (0x00)
        Address: 00:00:00:00:00:00 (OUI 00-00-00)
< HCI Command: LE Read Buffer Size (0x08|0x0002) plen 0                      #51 [hci0] 13.461652
> HCI Event: Command Complete (0x0e) plen 7                                  #52 [hci0] 13.462494
      LE Read Buffer Size (0x08|0x0002) ncmd 1
        Status: Success (0x00)
        Data packet length: 27
        Num data packets: 7
< HCI Command: LE Read Local Supported Features (0x08|0x0003) plen 0         #53 [hci0] 13.462554
> HCI Event: Command Complete (0x0e) plen 12                                 #54 [hci0] 13.463537
      LE Read Local Supported Features (0x08|0x0003) ncmd 1
        Status: Success (0x00)
        Features: 0xff 0x49 0x01 0x00 0x00 0x00 0x00 0x00
          LE Encryption
          Connection Parameter Request Procedure
          Extended Reject Indication
          Slave-initiated Features Exchange
          LE Ping
          LE Data Packet Length Extension
          LL Privacy
          Extended Scanner Filter Policies
          LE 2M PHY
          LE Coded PHY
          Channel Selection Algorithm #2
          Minimum Number of Used Channels Procedure
< HCI Command: LE Read Supported States (0x08|0x001c) plen 0                 #55 [hci0] 13.463598
> HCI Event: Command Complete (0x0e) plen 12                                 #56 [hci0] 13.464521
      LE Read Supported States (0x08|0x001c) ncmd 1
        Status: Success (0x00)
        States: 0x000003ffff3fffff
          Non-connectable Advertising State
          Scannable Advertising State
          Connectable Advertising State
          High Duty Cycle Directed Advertising State
          Passive Scanning State
          Active Scanning State
          Initiating State
            and Connection State (Master Role)
          Connection State (Slave Role)
          Non-connectable Advertising State
            and Passive Scanning State
          Scannable Advertising State
            and Passive Scanning State
          Connectable Advertising State
            and Passive Scanning State
          High Duty Cycle Directed Advertising State
            and Passive Scanning State
          Non-connectable Advertising State
            and Active Scanning State
          Scannable Advertising State
            and Active Scanning State
          Connectable Advertising State
            and Active Scanning State
          High Duty Cycle Directed Advertising State
            and Active Scanning State
          Non-connectable Advertising State
            and Initiating State
          Scannable Advertising State
            and Initiating State
          Non-connectable Advertising State
            and Connection State (Master Role)
          Scannable Advertising State
            and Connection State (Master Role)
          Non-connectable Advertising State
            and Connection State (Slave Role)
          Scannable Advertising State
            and Connection State (Slave Role)
          Passive Scanning State
            and Connection State (Master Role)
          Active Scanning State
            and Connection State (Master Role)
          Passive Scanning State
            and Connection State (Slave Role)
          Active Scanning State
            and Connection State (Slave Role)
          Initiating State
            and Connection State (Master Role)
            and Master Role & Master Role
          Low Duty Cycle Directed Advertising State
          Low Duty Cycle Directed Advertising State
            and Passive Scanning State
          Low Duty Cycle Directed Advertising State
            and Active Scanning State
          Connectable Advertising State
            and Initiating State
            and Master Role & Slave Role
          High Duty Cycle Directed Advertising State
            and Initiating State
            and Master Role & Slave Role
          Low Duty Cycle Directed Advertising State
            and Initiating State
            and Master Role & Slave Role
          Connectable Advertising State
            and Connection State (Master Role)
            and Master Role & Slave Role
          High Duty Cycle Directed Advertising State
            and Connection State (Master Role)
            and Master Role & Slave Role
          Low Duty Cycle Directed Advertising State
            and Connection State (Master Role)
            and Master Role & Slave Role
          Connectable Advertising State
            and Connection State (Slave Role)
            and Master Role & Slave Role
          High Duty Cycle Directed Advertising State
            and Connection State (Slave Role)
            and Slave Role & Slave Role
          Low Duty Cycle Directed Advertising State
            and Connection State (Slave Role)
            and Slave Role & Slave Role
          Initiating State
            and Connection State (Slave Role)
            and Master Role & Slave Role
< HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0            #57 [hci0] 13.464584
> HCI Event: Command Complete (0x0e) plen 68                                 #58 [hci0] 13.465756
      Read Local Supported Commands (0x04|0x0002) ncmd 1
        Status: Success (0x00)
        Commands: 66 entries
          Disconnect (Octet 0 - Bit 5)
          Read Remote Version Information (Octet 2 - Bit 7)
          Set Event Mask (Octet 5 - Bit 6)
          Reset (Octet 5 - Bit 7)
          Read Transmit Power Level (Octet 10 - Bit 2)
          Set Controller To Host Flow Control (Octet 10 - Bit 5)
          Host Buffer Size (Octet 10 - Bit 6)
          Host Number of Completed Packets (Octet 10 - Bit 7)
          Read Local Version Information (Octet 14 - Bit 3)
          Read Local Supported Features (Octet 14 - Bit 5)
          Read BD ADDR (Octet 15 - Bit 1)
          Read RSSI (Octet 15 - Bit 5)
          Set Event Mask Page 2 (Octet 22 - Bit 2)
          LE Set Event Mask (Octet 25 - Bit 0)
          LE Read Buffer Size (Octet 25 - Bit 1)
          LE Read Local Supported Features (Octet 25 - Bit 2)
          LE Set Random Address (Octet 25 - Bit 4)
          LE Set Advertising Parameters (Octet 25 - Bit 5)
          LE Read Advertising Channel TX Power (Octet 25 - Bit 6)
          LE Set Advertising Data (Octet 25 - Bit 7)
          LE Set Scan Response Data (Octet 26 - Bit 0)
          LE Set Advertise Enable (Octet 26 - Bit 1)
          LE Set Scan Parameters (Octet 26 - Bit 2)
          LE Set Scan Enable (Octet 26 - Bit 3)
          LE Create Connection (Octet 26 - Bit 4)
          LE Create Connection Cancel (Octet 26 - Bit 5)
          LE Read White List Size (Octet 26 - Bit 6)
          LE Clear White List (Octet 26 - Bit 7)
          LE Add Device To White List (Octet 27 - Bit 0)
          LE Remove Device From White List (Octet 27 - Bit 1)
          LE Connection Update (Octet 27 - Bit 2)
          LE Set Host Channel Classification (Octet 27 - Bit 3)
          LE Read Channel Map (Octet 27 - Bit 4)
          LE Read Remote Used Features (Octet 27 - Bit 5)
          LE Encrypt (Octet 27 - Bit 6)
          LE Rand (Octet 27 - Bit 7)
          LE Start Encryption (Octet 28 - Bit 0)
          LE Long Term Key Request Reply (Octet 28 - Bit 1)
          LE Long Term Key Request Neg Reply (Octet 28 - Bit 2)
          LE Read Supported States (Octet 28 - Bit 3)
          LE Receiver Test (Octet 28 - Bit 4)
          LE Transmitter Test (Octet 28 - Bit 5)
          LE Test End (Octet 28 - Bit 6)
          Read Authenticated Payload Timeout (Octet 32 - Bit 4)
          Write Authenticated Payload Timeout (Octet 32 - Bit 5)
          LE Remote Connection Parameter Request Reply (Octet 33 - Bit 4)
          LE Remote Connection Parameter Request Negative Reply (Octet 33 - Bit 5)
          LE Set Data Length (Octet 33 - Bit 6)
          LE Read Suggested Default Data Length (Octet 33 - Bit 7)
          LE Write Suggested Default Data Length (Octet 34 - Bit 0)
          LE Add Device To Resolving List (Octet 34 - Bit 3)
          LE Remove Device From Resolving List (Octet 34 - Bit 4)
          LE Clear Resolving List (Octet 34 - Bit 5)
          LE Read Resolving List Size (Octet 34 - Bit 6)
          LE Read Peer Resolvable Address (Octet 34 - Bit 7)
          LE Read Local Resolvable Address (Octet 35 - Bit 0)
          LE Set Address Resolution Enable (Octet 35 - Bit 1)
          LE Set Resolvable Private Address Timeout (Octet 35 - Bit 2)
          LE Read Maximum Data Length (Octet 35 - Bit 3)
          LE Read PHY (Octet 35 - Bit 4)
          LE Set Default PHY (Octet 35 - Bit 5)
          LE Set PHY (Octet 35 - Bit 6)
          LE Enhanced Receiver Test (Octet 35 - Bit 7)
          LE Enhanced Transmitter Test (Octet 36 - Bit 0)
          LE Read Transmit Power (Octet 38 - Bit 7)
          LE Set Privacy Mode (Octet 39 - Bit 2)
< HCI Command: Set Event Mask (0x03|0x0001) plen 8                           #59 [hci0] 13.465839
        Mask: 0x200080000204e890
          Disconnection Complete
          Encryption Change
          Read Remote Version Information Complete
          Command Complete
          Command Status
          Hardware Error
          Number of Completed Packets
          Data Buffer Overflow
          Encryption Key Refresh Complete
          LE Meta
> HCI Event: Command Complete (0x0e) plen 4                                  #60 [hci0] 13.466569
      Set Event Mask (0x03|0x0001) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Event Mask (0x08|0x0001) plen 8                        #61 [hci0] 13.466600
        Mask: 0x0000000000080e7f
          LE Connection Complete
          LE Advertising Report
          LE Connection Update Complete
          LE Read Remote Used Features Complete
          LE Long Term Key Request
          LE Remote Connection Parameter Request
          LE Data Length Change
          LE Enhanced Connection Complete
          LE Direct Advertising Report
          LE PHY Update Complete
          LE Channel Selection Algorithm
> HCI Event: Command Complete (0x0e) plen 4                                  #62 [hci0] 13.467520
      LE Set Event Mask (0x08|0x0001) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Read Advertising Channel TX Power (0x08|0x0007) plen 0     #63 [hci0] 13.467586
> HCI Event: Command Complete (0x0e) plen 5                                  #64 [hci0] 13.468513
      LE Read Advertising Channel TX Power (0x08|0x0007) ncmd 1
        Status: Success (0x00)
        TX power: 0 dbm (0x00)
< HCI Command: LE Read White List Size (0x08|0x000f) plen 0                  #65 [hci0] 13.468575
> HCI Event: Command Complete (0x0e) plen 5                                  #66 [hci0] 13.469487
      LE Read White List Size (0x08|0x000f) ncmd 1
        Status: Success (0x00)
        Size: 8
< HCI Command: LE Clear White List (0x08|0x0010) plen 0                      #67 [hci0] 13.469548
> HCI Event: Command Complete (0x0e) plen 4                                  #68 [hci0] 13.470482
      LE Clear White List (0x08|0x0010) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Read Resolving List Size (0x08|0x002a) plen 0              #69 [hci0] 13.470542
> HCI Event: Command Complete (0x0e) plen 5                                  #70 [hci0] 13.471481
      LE Read Resolving List Size (0x08|0x002a) ncmd 1
        Status: Success (0x00)
        Size: 8
< HCI Command: LE Clear Resolving List (0x08|0x0029) plen 0                  #71 [hci0] 13.471542
> HCI Event: Command Complete (0x0e) plen 4                                  #72 [hci0] 13.472453
      LE Clear Resolving List (0x08|0x0029) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Resolvable Private Address Tim.. (0x08|0x002e) plen 2  #73 [hci0] 13.472513
        Timeout: 900 seconds
> HCI Event: Command Complete (0x0e) plen 4                                  #74 [hci0] 13.473434
      LE Set Resolvable Private Address Timeout (0x08|0x002e) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Read Maximum Data Length (0x08|0x002f) plen 0              #75 [hci0] 13.473512
> HCI Event: Command Complete (0x0e) plen 12                                 #76 [hci0] 13.474476
      LE Read Maximum Data Length (0x08|0x002f) ncmd 1
        Status: Success (0x00)
        Max TX octets: 27
        Max TX time: 2704
        Max RX octets: 27
        Max RX time: 2704
< HCI Command: LE Read Suggested Default Data Length (0x08|0x0023) plen 0    #77 [hci0] 13.474550
> HCI Event: Command Complete (0x0e) plen 8                                  #78 [hci0] 13.475440
      LE Read Suggested Default Data Length (0x08|0x0023) ncmd 1
        Status: Success (0x00)
        TX octets: 27
        TX time: 328
< HCI Command: Set Event Mask Page 2 (0x03|0x0063) plen 8                    #79 [hci0] 13.475483
        Mask: 0x0000000000800000
          Authenticated Payload Timeout Expired
> HCI Event: Command Complete (0x0e) plen 4                                  #80 [hci0] 13.476496
      Set Event Mask Page 2 (0x03|0x0063) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Write Suggested Default Data Length (0x08|0x0024) plen 4   #81 [hci0] 13.476510
        TX octets: 27
        TX time: 2704
> HCI Event: Command Complete (0x0e) plen 4                                  #82 [hci0] 13.477442
      LE Write Suggested Default Data Length (0x08|0x0024) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Default PHY (0x08|0x0031) plen 3                       #83 [hci0] 13.477513
        All PHYs preference: 0x00
        TX PHYs preference: 0x01
          LE 1M
        RX PHYs preference: 0x01
          LE 1M
> HCI Event: Command Complete (0x0e) plen 4                                  #84 [hci0] 13.478477
      LE Set Default PHY (0x08|0x0031) ncmd 1
        Status: Success (0x00)
= Index Info: 00:00:00:00:00:00 (The Linux Foundation)                           [hci0] 13.478514
< HCI Command: LE Set Advertising Data (0x08|0x0008) plen 32                 #85 [hci0] 13.478563
        Length: 6
        Flags: 0x04
          BR/EDR Not Supported
        TX power: 0 dBm
> HCI Event: Command Complete (0x0e) plen 4                                  #86 [hci0] 13.479510
      LE Set Advertising Data (0x08|0x0008) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Response Data (0x08|0x0009) plen 32               #87 [hci0] 13.479600
        Length: 13
        Name (short): core-firmw
> HCI Event: Command Complete (0x0e) plen 4                                  #88 [hci0] 13.481443
      LE Set Scan Response Data (0x08|0x0009) ncmd 1
        Status: Success (0x00)
@ MGMT Event: Command Complete (0x0001) plen 7                          {0x0001} [hci0] 13.481496
      Set Powered (0x0005) plen 4
        Status: Success (0x00)
        Current settings: 0x00008a01
          Powered
          Low Energy
          Secure Connections
          Static Address
@ MGMT Command: Set Powered (0x0005) plen 1                             {0x0001} [hci0] 13.481556
        Powered: Enabled (0x01)
@ MGMT Event: Command Complete (0x0001) plen 7                          {0x0001} [hci0] 13.481563
      Set Powered (0x0005) plen 4
        Status: Success (0x00)
        Current settings: 0x00008a01
          Powered
          Low Energy
          Secure Connections
          Static Address
@ RAW Open: hcitool (privileged) version 2.22                                  {0x0002} 27.493602
@ RAW Close: hcitool                                                           {0x0002} 27.493611
@ RAW Open: hcitool (privileged) version 2.22                                  {0x0002} 63.933710
@ RAW Close: hcitool                                                           {0x0002} 63.933748
@ RAW Open: hcitool (privileged) version 2.22                                  {0x0002} 63.933762
@ RAW Close: hcitool                                                           {0x0002} 63.933770
@ RAW Open: hcitool (privileged) version 2.22                           {0x0002} [hci0] 63.933784
< HCI Command: LE Transmitter Test (0x08|0x001e) plen 4                      #89 [hci0] 63.933928
        invalid packet size
        02 20 00 00                                      . ..            
> HCI Event: Command Complete (0x0e) plen 4                                  #90 [hci0] 63.935645
      LE Transmitter Test (0x08|0x001e) ncmd 1
        Status: Success (0x00)
@ RAW Close: hcitool                                                    {0x0002} [hci0] 63.935768
@ RAW Open: hcitool (privileged) version 2.22                                  {0x0002} 77.997643
@ RAW Close: hcitool                                                           {0x0002} 77.997652
@ RAW Open: hcitool (privileged) version 2.22                                  {0x0002} 77.997656
@ RAW Close: hcitool                                                           {0x0002} 77.997657
@ RAW Open: hcitool (privileged) version 2.22                           {0x0002} [hci0] 77.997663
< HCI Command: LE Test End (0x08|0x001f) plen 0                              #91 [hci0] 78.008578
> HCI Event: Command Complete (0x0e) plen 6                                  #92 [hci0] 84.156464
      LE Test End (0x08|0x001f) ncmd 1
        Status: Success (0x00)
        Number of packets: 0
@ RAW Close: hcitool                                                    {0x0002} [hci0] 84.156669

The problem also occurs when i call ll_test_tx() from firmware on my own not just while connected to hci or so. It was showed made so it could be replicated using HCI- UART example.

Can you help me with formatting this ? :) I am not familiar how to hide/collapse this big chunk of data...

piotrParf commented 2 years ago

From what I found up to date: When running the ll_test_tx(1,20,0,0x01) function from firmware code the packets start transmitting and I am receiving the test packets at other side of the testing enviroment. But at some point(about 2500-4000 packets elapsed) the transmission timer is transmitting with very big period of time. When I measure the period beetwen the interrupts when this "long period starts happening" I receive value of 549762. I am trying out how the timer is being used to trigger the radio sending packets in ll_test and i do not figured it out to the moment...

piotrParf commented 2 years ago

Why in ll_test.c the isr_tx() is written in such a manner ? Especially this fragment ?

s = radio_tmr_sample_get();
while (t < s) {
    t += SCAN_INT_UNIT_US;
}
/* Setup next Tx */
radio_switch_complete_and_disable();
radio_tmr_start_us(1, t);

What I observed is the issue happens when difference between t and s is so large the while loop takes so long time that the t value is being written to timer in the "past" due to sampling of s far before end of while loop. Because of this radio timer invokes after timer overflows which takes a lot of time.

Isn`t it better to replace the while loop with below code ?

if (t < s){
    t=((((s - t) / SCAN_INT_UNIT_US) + 1) * SCAN_INT_UNIT_US);
} 

What do you think @cvinayak? For me it solves the issue of "stopped/very big period of packet sending during test". I do not know how it behaves on other platforms than nrf5340.

cvinayak commented 2 years ago

It is an old implementation, the difference should not be large and the while loop should not iterate too many times such that it is not able to meet the next 625us. But I do see that under rollover of the timer count, the difference will be incorrectly very high.

Your suggestion is good, but do add implementation to handle rollover scenario. Please send a pull request with your changes, we can continue to refine the changes in that PR.

piotrParf commented 2 years ago

should I do pool request on current dev branch or some 2.7 lts ? I am not familiar with working with such a huge system.

cvinayak commented 2 years ago

You should send the pull request to the latest main branch, backports will be generated by github actions when we add labels. For contributing guide, refer to https://docs.zephyrproject.org/latest/contribute/index.html#contribution-workflow

piotrParf commented 2 years ago

I created a pull request. There is another issue which activates this bug. It is in default config definitions of BLE for nrf5340. I observed that radio_tmr_end_get() always returns zero in 2.7 LTS. The defines of radio_tmr_end_capture(void) are changed in radio.c at current main branch. Changing this to current main branch makes proper invocation of radio_tmr_end_capture(). I found that this is related to CONFIG_BT_CTLR_TIFS_HW_SUPPORT=y and CONFIG_BT_CTLR_RADIO_ENABLE_FAST=y not setting up CONFIG_BT_CTLR_TIFS_HW in 2.7 LTS.

dhananjaygj commented 2 years ago

We are also trying to use the DTM functionality of zephyr BLE controller with nRF53. We are facing problem where ll_test_tx works only for maximum 1 second and after that i don't see any RF signals in the analyser. @piotrParf Have you faced a problem like this too? Does your PR (https://github.com/zephyrproject-rtos/zephyr/pull/42866) fix DTM related timer issues? From your last comment, do you mean to say we should enable CONFIG_BT_CTLR_TIFS_HW for nRF53?

piotrParf commented 2 years ago

@dhananjaygj From what I found enabling CONFIG_BT_CTLR_TIFS_HW will work but to make it work you need also to set BT_CTLR_ADVANCED_FEATURES=y otherwise it is not possible to set BT_CTLR_RADIO_ENABLE_FAST=n. But the timers can still rollover and wait a long time without fixing it(it is rare but can). For me that PR fixed the issue because the radio sampling timer handlers are failing(functions radio_tmr_end_capture is written otherway in never versions and radio_tmr_end_get reads zero) with 2.7 on nrf5340 on default configuration with CONFIG_BT_CTLR_TIFS_HW disabled.