I am trying to use the nrf util software to upgrade (i.e. bootload) my product.
The interface between PC/product is serial, through a USB/RS485 port... but framing is as per RS232/UART.
Within the product both the application and bootloader firmware share the same RS485 interface.
To separate the functionality, the bootloader (i.e. using DFU) is setup to communicate using "SPACE" parity for data transferred.
Whereas the application uses "NO" parity.
The baud rate for both is 38400.
Side Note: it is extremely difficult to find a terminal program such as putty which has a mark/space parity options...
I have modified the python code in "dfu_transport_serial.py", from line 215 to:
baudrate=self.baud_rate, rtscts=self.flow_control, parity='S', timeout=self.DEFAULT_SERIAL_PORT_TIMEOUT)
I have also a simple python script listening on another RS485 port (for desktop debugging only)
The command I use to launch the DFU is:
python __main__.py dfu serial -pkg sbms1_master-mcu-application_16s_1fe98f3f.zip -p COM16 -fc 0 -b 38400 -t 10
This script fails at the ping command:
[------------------------------------] 0%
Traceback (most recent call last):
File "__main__.py", line 1545, in <module>
cli()
File "C:\Python38\lib\site-packages\click\core.py", line 1137, in __call__
return self.main(*args, **kwargs)
File "C:\Python38\lib\site-packages\click\core.py", line 1062, in main
rv = self.invoke(ctx)
File "C:\Python38\lib\site-packages\click\core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Python38\lib\site-packages\click\core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Python38\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Python38\lib\site-packages\click\core.py", line 763, in invoke
return __callback(*args, **kwargs)
File "__main__.py", line 1063, in serial
do_serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, serial_number, True,
File "__main__.py", line 978, in do_serial
dfu.dfu_send_images()
File "C:\Python38\lib\site-packages\nordicsemi\dfu\dfu.py", line 127, in dfu_send_images
self._dfu_send_image(self.manifest.application)
File "C:\Python38\lib\site-packages\nordicsemi\dfu\dfu.py", line 88, in _dfu_send_image
self.dfu_transport.open()
File "C:\Python38\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 214, in open
raise NordicSemiException("No ping response after opening COM port")
pc_ble_driver_py.exceptions.NordicSemiException: No ping response after opening COM port
When I set the RS485 listening script to 8N1 and separately launch the DFU I see the data:
Rx Data: b'\t\x01\xc0'
Rx Data: b'\t\x02\xc0\t\x03\xc0'
Rx Data: b'\t\x04\xc0\t\x05\xc0'
Rx Data: b'\t\x06\xc0\t\x07\xc0'
Rx Data: b'\t\x08\xc0\t\t\xc0'
Rx Data: b'\t\n\xc0'
When I set the RS485 listening script to 8NS and separately launch the DFU I see the data:
Rx Data: b'\t\x01\xe0'
Rx Data: b'\t\x02\xe0\t\x03\xe0'
Rx Data: b'\t\x84\xe0\t\x05\xe0'
Rx Data: b'\t\x06\xe0\t\x07\xe0'
Rx Data: b'\t\x08\xe0\t\t\xe0'
Rx Data: b'\t\x85\xe0'
I can use a seperate python script to ping the product in bootloader mode with 8NS from the same machine:
Tx Data: b'\t\xff\xc0'
Rx Data: b'`\t\x01\xff\xc0'
Tx Data: b'\t\xff\xc0'
Rx Data: b'`\t\x01\xff\xc0'
Tx Data: b'\t\xff\xc0'
Rx Data: b'`\t\x01\xff\xc0'
And I actually get a response
Side Note: the DFU process, using the above process works on others (colleagues) machines...
So my questions are:
1. Is the modified code to set the serial port to space parity correct?
2. Is there anywhere else within the DFU application where it might be overriding these parity settings?
3. Is space parity even supported?
4. Could it be anything to do with the USB/RS485 drivers, Windows 10 (my laptop)?
5. Is there any dependancy issues with the pyserial library (or any other libraries that are part of the application) that I could be missing.
I have tried many things, even different USB/RS485 dongles (i.e. different brand ICs), but stumped at this point.
Any help is muchly appreciated.
Thanks, in advance!!!