3.1 SAM-BA®: Serial Port Connection Issue
The following error indicates that the SAM-BA tool cannot establish proper communication with the target device over the specified serial port, either due to the port being in use or an incorrect setup.
$ sam-ba -p serial -b sama7d65-curiosity -a readuniqueid
SAM-BA Command Line Interface Tool v3.9.1 (linux - x86_64little_endian-lp64)
Copyright 2025 Microchip Technology
Opening serial port 'ttyUSB0' (UART)
ERROR: timeout occurred when reading data from device
Error: Could not switch monitor on port 'ttyUSB0' to binary mode
Execution time: 276 ms
Connection closed.
$sam-ba -p serial -b sama7g54-ek -a readuniqueid
SAM-BA Command Line Interface Tool v3.9.1 (winnt - i386-little_endian-ilp32)
Copyright 2025 Microchip Technology
Opening serial port 'COM14' (USB)
Error: Could not open serial port 'COM14': Access is denied.
Execution time: 188 ms
Check the following:
- The serial communication port might already be in use by another application (such as HyperTerminal, Minicom or a screen). Verify that the device is visible in the Device Manager and that the port is free.
- Ensure that BOOT_DIS is enabled, all non-volatile memories (NVM) are cleared and the device is entering the SAM-BA Monitor mode.
- Verify that the UART baud rate is correctly set for communication with the target device through the FTDI interface.
- When using a UART cable for programming, make sure the USB cable is disconnected. By default, the console may be taken over by the USB interface if it is connected.
- Double-check that
/dev/ttyUSB0is not being used by another terminal application. Even if this has already been verified, it is important to remain cautious about this.
If the error occurs intermittently (about two out of three attempts), try using a different USB cable to rule out hardware-related issues.
