limpkin / cdm324_fft

Repository for the CDM324 backpack v2
MIT License
14 stars 5 forks source link

CDM324 Monitoring Tool does not connect #9

Open henridbr opened 4 months ago

henridbr commented 4 months ago

Hi,

Using the bootloader I was able to change the baud rate to 57600.

At first I replaced the baud rate of 1000000 by 57600 in the scripts:

I connected the expansion board to my computer by USB, it's on COM8 set at 57600 bauds.

Then : python "C:\Users\henri\...\cdm324_fft-main\scripts\_start.py" and I got the CDM324 Monitoring Tool.

Unfortunately it did not connect. The port field changed alternatively from COM4 to COM8 with the background color in white, but nothing occurs. When I disconnected the USB cable, the backcolor of the COM field became red with the warning "No COM ports detected!"

Pushing the Debug button, I got some information:

PS C:\Users\henri> python "C:\Users\henri...\cdm324_fft-main\scripts_start.py" Exception in Tkinter callback Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64qbz5n2kfra8p0\Lib\tkinter__init.py", line 1967, in call__ return self.func(*args) ^^^^^^^^^^^^^^^^ File "C:\Users\henri...\cdm324_fft-main\scripts_start.py", line 226, in self.update_fw_button = tk.Button(self, text="Start Debug Tool", font=tkfont.Font(family='Helvetica', size=9), width="18", command=lambda:[self.start_debug_tool()]) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\henri...\cdm324_fft-main\scripts_start.py", line 98, in start_debug_tool stream_vis_start(self.com_port) File "C:\Users\henri...\cdm324_fft-main\scripts\stream_visualizer.py", line 253, in stream_vis_start platform_serial = serial.Serial(com_port, 57600) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\henri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\serial\serialwin32.py", line 33, in init super(Serial, self).init(*args, **kwargs) File "C:\Users\henri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\serial\serialutil.py", line 244, in init self.open() File "C:\Users\henri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\serial\serialwin32.py", line 64, in open raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError())) serial.serialutil.SerialException: could not open port '': FileNotFoundError(2, 'Le chemin d’accès spécifié est introuvable.', None, 3) Exception in Tkinter callback Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64qbz5n2kfra8p0\Lib\tkinter__init.py", line 1967, in call return self.func(*args) ^^^^^^^^^^^^^^^^ File "C:\Users\henri...\cdm324_fft-main\scripts_start.py", line 226, in self.update_fw_button = tk.Button(self, text="Start Debug Tool", font=tkfont.Font(family='Helvetica', size=9), width="18", command=lambda:[self.start_debug_tool()]) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\henri...\cdm324_fft-main\scripts_start.py", line 98, in start_debug_tool stream_vis_start(self.com_port) File "C:\Users\henri...\cdm324_fft-main\scripts\stream_visualizer.py", line 253, in stream_vis_start platform_serial = serial.Serial(com_port, 57600) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\henri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\serial\serialwin32.py", line 33, in init super(Serial, self).init__(*args, **kwargs) File "C:\Users\henri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\serial\serialutil.py", line 244, in init self.open() File "C:\Users\henri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\serial\serialwin32.py", line 64, in open raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError())) serial.serialutil.SerialException: could not open port '': FileNotFoundError(2, 'Le chemin d’accès spécifié est introuvable.', None, 3)

Marcus-Peterson commented 4 months ago

Could you share your code here so that we can help?

henridbr commented 4 months ago

This is the code I modified by replacing 1000000 by 57600 which the actual baud rate.

In stream_visualizer.py from line 248:

def stream_vis_start(com_port):
    global platform_serial_initialized
    global platform_serial

    platform_serial_initialized = False
    platform_serial = serial.Serial(com_port, 57600)
    platform_serial.set_buffer_size(rx_size = 57600, tx_size = 57600)
    platform_serial.rts = False

    # Start GUI
    popup = CDM324()
    popup.configure_traits()    

In cdm324_device.py from line 24:

    # Connect to device
    def connect(self, COM_port):
        self.com_port = COM_port    

        # Open COM port
        self.serial = serial.Serial(self.com_port, 57600)
        self.serial.set_buffer_size(rx_size = 57600, tx_size = 57600)

        # Disable RTS to release RESET
limpkin commented 4 months ago

the rx_size & tx_size value shouldn't be changed (they are buffer size values). Only the serial.Serial() value should be changed. Can you confirm that a standard terminal program allows you to talk to the platform?

henridbr commented 4 months ago

I tried both buffer sizes, same result with the GUI and debug. Connected by USB to the expansion board with the port set at 57600 bauds, I receive the boot message (reset button) and some speed values but not each time I send "k". It works fine with the FTDI232.

limpkin commented 4 months ago

So I just re-tried on my end flashing the 57600 firmware (with the _start.py script), modifying line 29 of _start.py to change '1000000' with '57600' and managed to get the GUI (not debug tool) running. Please note that the debug tool will NOT work with a 57600 firmware as the baud rate will simply limit what's possible to broadcast.