
RFtool for Windows is working with Atmosic EVK that supports BLE direct test mode.
It uses a 4-wire HCI UART Transport Layer (see BLUETOOTH
SPECIFICATION Version 5.0 | Vol 4, Part A) on UART0.  Designs that
support the Atmosic Reference Design Interface board will find UART0 on
the second port of USB0.

#HW
Need Atmosic interface board(ATM33 doesn't need this) and EVK

#ATM33##########################################################################
Microsoft by default will NOT have the j-link driver for the J-Link OB device
on the Atmosic board. Download J-Link software pack from the following location.

https://www.segger.com/downloads/jlink/

The J-Link OB device driver must be replaced with WinUSB in order for it to
become available as a USB device and usable by OpenOCD.
This can be done using:
1) Zadig
2) Install RDI Interface(The windows installer will create this shortcut
in "Start Menu">>"AtmosicSDK")

Windows Administrator privileges are required for replacing a driver.

Zadig can be obtained from:

https://github.com/pbatard/libwdi/releases

At the time of this writing, the latest version -- 2.4 -- can be
obtained using the following direct link.

https://github.com/pbatard/libwdi/releases/download/b721/zadig-2.4.exe

To replace the driver:

1) From the "Options" menu of Zadig, click "List all devices".
2) From the drop-down menu, find "BULK interface" corresponding to
   the Atmosic board.  It should show "jlink (v...)" as
   the current driver on the left.
3) Select "WinUSB (v...)" as the replacement on the right.
4) Click "Replace Driver"

Verify the successful installation of WinUSB by going to the Windows
Device Manager and confirming that the "BULK interface" shows
as such rather than "J-Link driver".  (In Device Manager, expand category
"Universal Serial Bus devices" and look for "BULK interface".)

For IDE environment, the J-Link OB device driver must use J-Link driver.
This can be done using:
1) Uninstall BULK interface driver manually
2) Setup IDE Environment(The windows installer will create this shortcut
in "Start Menu">>"AtmosicSDK")
##############################################################################

#ATM2/3#######################################################################
Microsoft by default installs the FTDIBUS driver for the FTDI device
on the Atmosic board.  This makes the device show as a COM port in the
Windows Device Manager.

For Interface 0 of the Atmosic FTDI interface board, the FTDI driver
must be replaced with WinUSB in order for it to become available as a
USB device and usable by OpenOCD.  This can be done using Zadig.

Windows Administrator privileges are required for replacing a driver.

Zadig can be obtained from:

https://github.com/pbatard/libwdi/releases

At the time of this writing, the latest version -- 2.4 -- can be
obtained using the following direct link.

https://github.com/pbatard/libwdi/releases/download/b721/zadig-2.4.exe

To replace the driver:

1) From the "Options" menu of Zadig, click "List all devices".
2) From the drop-down menu, find USB1, Interface 0 corresponding to
   the Atmosic interface board.  It should show "FTDIBUS (v...)" as
   the current driver on the left.
3) Select "WinUSB (v...)" as the replacement on the right.
4) Click "Replace Driver"

Verify the successful installation of WinUSB by going to the Windows
Device Manager and confirming that the Atmosic FTDI USB1 device shows
as such rather than a COM port.  (In Device Manager, expand category
"Universal Serial Bus devices" and look for "Atmosic RDI USB1".)
Also, verify that the driver provider is libwdi.  (Right-click on
"Atmosic RDI USB1", go to "Properties", go to the "Driver" tab, and
check the "Driver Provider" line.)  Restart Windows if necessary.
##############################################################################

#ATM33########################################################################
Console output for current Atmosic ATM3330 goes to the JLink CDC UART
serial port.  That is Interface 2 of J-Link OB USB on the Atmosic
board.  In order to view the console output, use a serial terminal
program such as PuTTY (available from
https://www.chiark.greenend.org.uk/~sgtatham/putty) to connect to
JLink CDC UART port generated by the interface 2 of J-Link OB USB
with the baud rate set to 115200.

If using PuTTY, open a session with the following three parameters:

1) Serial line: <COM port> (see next paragraph)
2) Speed: 115200
3) Connection type: Serial

A common way to determine <COM port> for parameter #1 above is to use
the Windows Device Manager as follows.

a) Under the "View" menu, choose "Devices by container"
b) Under the container "J-Link", find "JLink CDC UART Port
 (COM<N>)", where <N> is some COM port sequence number

Then use "COM<N>" for the serial line parameter in PuTTY.
##############################################################################

#ATM2/3#######################################################################
##UART0 - HCI Port(USB0 - interface 1)
The default serial parameters are:
    460800 baud, 8 bits, no parity, 1 stop bit, RTS/CTS flow control

##UART1 - Console out(USB1 - interface 1)
The default serial parameters are:
    115200 baud, 8 bits, no parity, 1 stop bit

##SWD(USB1 - interface 0)
Will use the SWD interface to program FW. It requires a version of openocd >=
0.10.0+dev-00541-g723fc07d. A binary was included in fw_image\openocd-0.10.0 folder.
##############################################################################

#Program FW before using this rftool
Double click program_by_openocd.bat to program the pre-build HCI_vendor FW image

#Run GUI
Double click runui.bat to open the rftool GUI and select the correct UART port before using it's functions

#FW
Pre-build FW in fw_image folder:
    HCI_vendor.elf - this is flash image that used for program_by_openocd.bat
Note: The HCI_vendor source code code is in SDK/atmx/ATMxxxx-xxx/examples/HCI_vendor
    If you are not using Atmosic EVK, you may modify UART port setting of HCI_vendor.

#Windows OS
The recommended OS version is Windows 10.
