Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Add options to configure serial update timeouts #199

Merged
merged 84 commits into from
Feb 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
0eceace
Don't sleep while between device ping when doing UART serial update
May 16, 2018
adccb57
Stop pinging target when it responds while performing UART serial update
May 16, 2018
4e48180
Distinguish serial port timeout and ping timeout
May 17, 2018
d7f97b2
Corrected typo: s112_nrf51_6.0.0 to s112_nrf52_6.0.0
bjornspock Aug 21, 2018
432d900
Corrected typo in SD list and added v6.1 SDs
bjornspock Aug 22, 2018
43455f9
Add 'finished' message to Thread DFU
Sep 4, 2018
26c54dc
NCP-1945: Adding external app parameter and usage
frkv Sep 11, 2018
4a158d1
NCP-1904: Adding default=False for --external-app and making it into …
frkv Sep 11, 2018
7f9fb07
add boot vaidation
stianrh Sep 13, 2018
eedb903
protobuf files for boot validation
stianrh Sep 13, 2018
bac6373
Add Zigbee DFU image support
tomchy Sep 14, 2018
1c67a34
NRF-1904: Allowing --sd-req to not be set for --external_app
frkv Sep 14, 2018
9cf39bf
NRFFOSDK-12436: Undoing mergetool mishap
frkv Sep 17, 2018
f881ee1
NRFFOSDK-12346: Adding restriction for either --application, --softde…
frkv Sep 17, 2018
b4a5b02
NRFFOSDK-12346: Fixing comments from pull request
frkv Sep 17, 2018
fd6b9bd
NRFFOSDK-12346: Fixing boolean test of None
frkv Sep 17, 2018
a6c7f3b
NRFFOSDK-12346: Adding --zigbee-ota-hw-version (required) and --zigbe…
frkv Sep 17, 2018
91bae13
NRFFOSDK-12346: Fixing issue with not opening OTA file as binary (too…
frkv Sep 17, 2018
31ce9ca
Remove additional commas inside README.md
tomchy Sep 18, 2018
dd68ed6
BUGFIX: open binary file in a binary mode
tomchy Sep 18, 2018
b81d94e
Update DFU settings backup page together with DFU settings
tomchy Sep 14, 2018
0f2a4c6
Add setting for DFU settings backup page placement
tomchy Sep 18, 2018
3e76392
Extend unit tests by backup page checks
tomchy Sep 19, 2018
a34cec6
Add a warning about overwriting nRF DFU settings backup page
tomchy Sep 19, 2018
6e7759a
Change CLI name from VALIDATE_SHA256 to VALIDATE_GENERATED_SHA256 bec…
oyvindronningstad Sep 21, 2018
e07f59a
Add documentation and error messages for arguments to --boot-validation
oyvindronningstad Sep 21, 2018
6346008
Update required version of pc-ble-driver-py to latest available
bihanssen Sep 24, 2018
662921a
Refactored DFU Settings generation to allow for easier handling of no…
andvib Oct 9, 2018
64d29d9
Added version 2 for BL DFU Settings page
andvib Oct 10, 2018
0221e6b
Fixed minor bug in how crc was calculated from IntelHex object
andvib Oct 10, 2018
9f847e6
NRFFOSDK-NONE: adding comma in parameter list
frkv Oct 10, 2018
d41989f
NRFFOSDK-NONE: Removing pycharm debug code
frkv Oct 10, 2018
e63ab67
NRFFOSDK-NONE: Adding boot validation to NONE for the outter zigbee p…
frkv Oct 10, 2018
158ec56
Fixed small bug where 3's would appear the validation bytes field whe…
andvib Oct 15, 2018
e864cf4
Fixed minor error in key-file check
andvib Oct 15, 2018
64b3fcd
Fixed bug with nrfutil improperly handling trigger requests
e-rk Oct 10, 2018
e2be697
Added function for removing MBR addresses when generating DFU package…
andvib Oct 16, 2018
3b9f27c
Updated so that boot validation is not required when creating dfu pac…
andvib Oct 16, 2018
89c2092
Added pyspinel version 1.0.0a3 to requirements
e-rk Oct 26, 2018
6f607ae
Nrfutil now prints message after completed Thread DFU
e-rk Oct 26, 2018
caa8758
Added Zigbee Production Config feature; Updated OTA hex
czeslawmakarski Oct 31, 2018
614193f
Added unit tests for ZIgbee Production Config
czeslawmakarski Nov 8, 2018
ce93f9c
Added path-independent handling of tests
czeslawmakarski Nov 9, 2018
b1edba3
Don't do remove_mbr and remove_uicr on bin files (since they don't ha…
oyvindronningstad Nov 14, 2018
bc83e60
Always set sd_req to 0xFFFE ("Any") for zigbee outer image
oyvindronningstad Nov 14, 2018
49b7aa4
Create ISSUE_TEMPLATE.md
bihanssen Nov 27, 2018
fa66140
Updated table for Bootloader Settings version
andvib Nov 27, 2018
2533fdf
Updated settings page unittests to test settings page v2
andvib Jan 9, 2019
5e2425d
Updated SoftDevice table with version 6.1.1
andvib Jan 15, 2019
adea4a3
Updated SD table in package help text
andvib Jan 15, 2019
4304e78
Updated bl settings version helptext
andvib Jan 16, 2019
a4cc2ce
Added default boot validation type to settings generate
andvib Jan 16, 2019
3076062
Added documentation for external app and boot validation
andvib Jan 16, 2019
cc760ea
Split boot validation argument for pkg generate into two arguments (S…
andvib Jan 17, 2019
3a25e69
Added check for removing temporary generated SD bin
andvib Jan 17, 2019
8a63f51
Updated documentation regarding boot validation and SDK 15.3.0
andvib Jan 17, 2019
d0b74aa
Updated documentation based on review comments
andvib Jan 17, 2019
afebaaf
Fixed wrong function call for package generation for Zigbee, and chan…
andvib Jan 17, 2019
715602f
Updated documentation based on review
andvib Jan 18, 2019
33740de
Update version number to v5.0.0
bihanssen Jan 21, 2019
a64d154
Add ANT dfu transport.
jbootsma-ant Jul 24, 2018
f863fdf
Make ANT channel parameters configurable.
jbootsma-ant Jul 26, 2018
53db606
Platform support check for ant dfu
eugene-garmin Jan 25, 2019
a6816e9
Add list of ANT SoftDevices to FW ID table.
aledsi Jan 25, 2019
decebb6
antlib changes patched
eugene-garmin Jan 25, 2019
05b029a
Specify required version for protobuf
bihanssen Jan 29, 2019
822293b
Update README.md
bihanssen Jan 29, 2019
239c956
Update nordicsemi/__main__.py
bihanssen Jan 29, 2019
55243b6
Update nordicsemi/__main__.py
bihanssen Jan 29, 2019
7e2c64c
Add antlib to requirements.txt with platform limitation win32
bihanssen Feb 4, 2019
0022852
Update nordicsemi/dfu/dfu_transport_ant.py
bihanssen Feb 4, 2019
0baa5df
Include ant binaries to the pyinstaller spec file
bihanssen Feb 5, 2019
92ec2f2
Implement DFU trigger interface (#190)
mathiasap Feb 7, 2019
2d258ce
Tone down warning about overwriting nRF DFU settings backup page (#185)
bihanssen Feb 7, 2019
c9d9d66
Remove required-flag from some options (#184)
bihanssen Feb 7, 2019
4ee0f43
Revert "Placing public key in RAM if Oberon crypto backend is used." …
oyvindronningstad Feb 7, 2019
695a8f1
Ensure same command name on different operating systems (#186)
bihanssen Feb 8, 2019
29a67c1
Add version specifiers for pip requirements (#192)
bihanssen Feb 11, 2019
f3d92cf
Perform address argument validation (#187)
bihanssen Feb 12, 2019
eae6521
Update ant version specifier to accept beta release (#194)
bihanssen Feb 12, 2019
8fb40f3
Add references to 64bit libusb (#193)
bihanssen Feb 12, 2019
75191c7
Libusb and Pyinstaller (#196)
mathiasap Feb 13, 2019
21ae816
Revert modifications
bihanssen Feb 15, 2019
e869262
Merge branch 'master' into azanelli-actronika-dev-dfu-wait-for-board-…
bihanssen Feb 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion nordicsemi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,11 @@ def do_serial(package, port, connect_delay, flow_control, packet_receipt_notific
port = device.get_first_available_com_port()
logger.info("Resolved serial number {} to port {}".format(serial_number, port))

if timeout is None:
timeout = DfuTransportSerial.DEFAULT_TIMEOUT
if serial_timeout is None:
serial_timeout = DfuTransportSerial.DEFAULT_SERIAL_PORT_TIMEOUT

logger.info("Using board at serial port: {}".format(port))
serial_backend = DfuTransportSerial(com_port=str(port), baud_rate=baud_rate,
flow_control=flow_control, prn=packet_receipt_notification, do_ping=ping)
Expand Down Expand Up @@ -1017,7 +1022,16 @@ def usb_serial(package, port, connect_delay, flow_control, packet_receipt_notifi
help='Serial number of the device. Ignored if --port is set.',
type=click.STRING,
required=False)
def serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, serial_number):
@click.option('-t', '--timeout',
help='Set the timeout in seconds for board to respond (default: 30 seconds)',
type=click.INT,
required=False)
@click.option('-st', '--serial-timeout',
help='Set the timeout in seconds for the serial line (default: 1 second)',
type=click.FLOAT,
required=False)
def serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, serial_number,
timeout, serial_timeout):
"""Perform a Device Firmware Update on a device with a bootloader that supports UART serial DFU."""

do_serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, serial_number, True)
Expand Down
11 changes: 7 additions & 4 deletions nordicsemi/dfu/dfu_transport_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class DfuTransportSerial(DfuTransport):

DEFAULT_BAUD_RATE = 115200
DEFAULT_FLOW_CONTROL = True
DEFAULT_TIMEOUT = 30.0 # Timeout time for board response
DEFAULT_SERIAL_PORT_TIMEOUT = 1.0 # Timeout time on serial port read
DEFAULT_PRN = 0
DEFAULT_DO_PING = True
Expand All @@ -170,7 +171,8 @@ def __init__(self,
com_port,
baud_rate=DEFAULT_BAUD_RATE,
flow_control=DEFAULT_FLOW_CONTROL,
timeout=DEFAULT_SERIAL_PORT_TIMEOUT,
timeout=DEFAULT_TIMEOUT,
serial_timeout=DEFAULT_SERIAL_PORT_TIMEOUT,
prn=DEFAULT_PRN,
do_ping=DEFAULT_DO_PING):

Expand All @@ -179,6 +181,7 @@ def __init__(self,
self.baud_rate = baud_rate
self.flow_control = 1 if flow_control else 0
self.timeout = timeout
self.serial_timeout = serial_timeout
self.prn = prn
self.serial_port = None
self.dfu_adapter = None
Expand All @@ -195,7 +198,7 @@ def open(self):
try:
self.__ensure_bootloader()
self.serial_port = Serial(port=self.com_port,
baudrate=self.baud_rate, rtscts=self.flow_control, timeout=self.timeout)
baudrate=self.baud_rate, rtscts=self.flow_control, timeout=self.serial_timeout)
self.dfu_adapter = DFUAdapter(self.serial_port)
except Exception as e:
raise NordicSemiException("Serial port could not be opened on {0}"
Expand All @@ -204,10 +207,10 @@ def open(self):
if self.do_ping:
ping_success = False
start = datetime.now()
while datetime.now() - start < timedelta(seconds=self.timeout):
while (datetime.now() - start < timedelta(seconds=self.timeout)
and ping_success == False):
if self.__ping() == True:
ping_success = True
time.sleep(1)

if ping_success == False:
raise NordicSemiException("No ping response after opening COM port")
Expand Down