Configuring 2 XBee Modules on OSX for wireless connection - macos

I am trying find out how and with which program for OSX (10.5.8) I can configure serial ports? I am trying to establish a wireless connection between two Xbee´s (RF modules) and cannot figure out how to use ZTerm nor screen under Terminal. The setup I am using is: an Arduino+Xbeeshield+Xbee with external power supply, and an xbee on the xbee explorer connected to the Computer via USB.
I am trying to gather information on this through various forums, but most of them cover the configuration issue for PC using X-CTU (which I tried with CrossOver but it doesn´t recognize ny of my ports). According to one source, using screen under Terminal should show me all my serial ports, particularly /dev/tty.KeySerial1 - but it doesn´t show, even though I´ve plugged in both my arduino+xbee shield and the xbee on the explorer.

/dev/tty.KeySerial1 is incorrect.
First step is to get the FTDI USB driver installed if it has not yet been installed. The fastest way to determine if it is installed or not is to connect the XBee Explorer board. Then go look in /dev for a device named tty.usbserial-XXXXXXXX (Xs will be a unique hex ID). If you see multiple devices like this, then you probably have the Arduino plugged in too and you will need to disconnect it to determine what the device name is for the XBee Explorer board.
Once you know the device name, all you need to do is the command "screen /dev/tty.usbserial-XXXXXXXXX 9600". That should do it for you.

You can configure the tty device itself using stty. Be sure to redirect input from the terminal you want to configure, as stty operates on it's input. For instance, to set a serial port to 9600, no parity, 8 data bits, and 1 stop bit, aka "9600N81" in Windows parlance, try:
stty 9600 cs8 -cstopb -parenb < /dev/tty.usbserial-xxxxxxxx
Programmatically, you do this by opening the serial port and using the termios(4) ioctls on the device. See the termios(4) man page for more assistance.

Related

How can I find the VID and PID of a device on the other end of a USB-to-Serial adapter?

I am attempting to connect to a weight-measuring scale using the following communication line: Laptop -> USB to DB-9 Serial adapter -> Scale. The problem I'm experiencing is that my laptop recognizes the adapter as the device on the COM port, thus when I check the VID and PID of the device, it gives me the IDs for the cable and not the scale. Is there some way to find the information for the device on the other end?
I am coding in Python using the PySerial library, but any general answer would be helpful. The adapter I'm using is a USB to UART PL2303 from Prolific Technology Inc. My OS is Windows 10.
I have tried connecting scales from multiple different brands using a USB-to-Serial adapter, and I get the same result. I haven't been able to establish a connection with any of them, with all queries to the scales not being responded to. Two such scales are the Sartorius Entris and the Mettler Toledo Excellence Plus.
EDIT: Responses are saying that serial devices do not have a VID or PID. In that case, how can I tell if a serial device is a certain device from a specific manufacturer? I'm trying to do this so I can recognize when a scale is plugged in and not some other device, using a Python program to communicate with the scale.
Serial devices dont have VID/PID pair.
In "historic" times PCs have two ports - parallel and serial (also known as RS-232). Serial devices are PnP devices, so dont need driver and because this no need VID/PID pair.
What scales are you used?
If industrial, is very possible that are based on RS-485 standard.

Using Putty to connect to a Cisco 4010 via built in usb port results in error 1450. Using windows 10 build 19044

I'm attempting to connect to a Cisco 4010 network switch via it's built in usb port (which internally is a usb to rs232 adapter wired to the back of the console port).
I have installed the Cisco usb console drivers version 3.1
When I plug into the usb port, the little green LED that indicates that the console port has switched to usb does not light up.
When I run putty, and attempt to connect via serial connection to COM16 (the usb to rs232 in the cisco switch) I get:
Unable to open connection to COM16
Opening '\.\COM16': Error 1450: Insufficient System resources exist to complete the requested service.
I have tried reinstalling the drivers to no effect.
I have 3 identical switches, which give me identical behaviour, all 3 new out of the box with no programming.
Changing the Baud rate makes no difference, not that I'm expecting it to as the issue seems to be COM16 doesn't exist or similar
Putty Settings and Device Manager
With the help of a colleague, we narrowed the issue down to windows using a default usb to rs232 driver rather than the cisco one I had installed. The big clue came when I tried using putty inside a VM and it worked, while on the host OS I was still getting error 1450.
We had to compeletely uninstall all drivers, reboot, reinstall drivers manually, reboot, then attempt the usb connection again.
The last comment here describes it:
https://community.cisco.com/t5/cisco-software-discussions/usb-console-cable/td-p/3952600
I will copy the solution across to here, for easier search of the solution for the next person who has the same issue.
For WIn10 , install the setup(x64).exe from the Cisco_usbconsole_driver_3_1.zip.
Check that the Cisco Serial (Comx) is using the correct driver provider which should be Cisco. Don't use the Cypress driver.
Device Manager
To update the driver,
If you installed it already and having issues, uninstall it using the setup(x64),exe then reboot PC.
Uninstall Cisco Driver
First, disconnect the blue Cisco USB console cable. Reinstall the Cisco USB console drive using setup(x64).exe from the Windows_64 folder which was extracted from file Cisco_usbconsole_driver_3_1.zip.
Reboot PC
Open device manager to observe the driver installation. Check that you see "Cisco USB to Serial Adapter". If you don't see it repeat the above steps.
if you see above "Cisco USB to Serial Adapter". then
Update Driver
Click UPDATE DRIVER, then Browse my computer for driver software.
Choose " Let me pick from a list of available driers on my Computer." Select "Cisco Serial".
Pick driver
Finally,. connect to the COM port x indicated in the Device Manager, Ports (COM & LPT) , Cisco Serial (COMx)

Simulate serial port device using stdin and stdout

Currently, I have a desktop app that I used to read and write data to a proprietary hardware device via a serial port interface. The app starts by listing the serial COM devices connected to the computer, and once a device is selected, one can interact with the app to communicate with the corresponding device. I no longer have such a device at hand, but I would still like to use the app nonetheless.
I have already developed a command-line utility that, given a binary message in stdin, emits the corresponding binary reply (the same reply that the proprietary hardware device would send via serial port) to stdout. Let's call this utility a simulator.
How do I set up a virtual serial port such that the app can detect it, and that whenever the app sends a message using the serial port protocol, such message is forwarded to the simulator, and the simulator's reply is returned back to the desktop app?
I'm on Mac OS 12 with an M1 CPU. I'm also open to solutions on Windows 10 (with less priority).
I have looked at previous questions on StackOverflow that might be similar to this one, but they were either incomplete or slightly different, with no obvious way to infer the solution for my actual problem.
Serial ports are unlike other channels. That's why separate system calls exist for them.
Normally, serial ports are created by physical devices (an old-fashioned serial port or a newer USB-based one) and the associated driver. Since writing a driver is quite difficult, a pragmatic and possibly unexpected approach would be to use hardware, specifically two USB-to-serial adapters. That way, a serial port is created by the drivers of the USB-to-serial adapter.
The two USB-to-serial adapters are wired to each other (RX to TX and vice versa). The will appear as two serial ports on macOS (/dev/cu.usb...).
The legacy application then connects to one of the serial ports. And your command line utility (acting as a device emulation) connects to the other serial port. All data send by the command line utility will go to the legacy application, and vice versa.
The remaining issue is how to connect your command line utility to the serial port. If you are lucky, you can use the screen command. But more likely, you will need to modify it to read and write from the serial port (instead of stdin and stdout).

How to send modem AT Commands to a board from from OSX

Does anyone out there who has developed on a dev board attached to a Mac OSX machine's USB port know how to send AT tty modem commands to the board? Arduino folks? Anyone?
TL;DR
I purchased a development STEVAL-SPBT2ATV2 "USB Dongle for the Bluetooth class 2 SPBT2532C2.AT module", which, according to the docs and spec has "downloaded FW, enabling the user to create a Bluetooth link with simple AT commands."
Which would be great, except all the documentation is only for old MS Windows, and doesn't give any hints on how to program this device from OSX or Linux.
Do I need to install a driver of some sort? Everything I've tried is like talking to a brick wall: I send commands, but nothing comes back from the board.
Things I've tried:
/dev/tty.Bluetooth-Modem already existed. Didn't seem to do anything. I think that's the built-in bluetooth device.
/dev/tty.AmpedUp-AMP-SPP and /dev/cu.AmpedUp-AMP-SPP showed up when I went to "Network -> set up bluetooth device" - which is good (correct device name) but strange, why under network?
Then under Bluetooth I can add a "serial port used to connect to this computer" and get the choice of Modem or RS-232. I guessed Modem.
I really hope I don't have to mess with the /etc/tty files
Nothing. the device never seems to react, or send any data back. I've tried several ways to send data to the device. Silence.
echo "AT+AB GPIOConfig 2 O^M" > /dev/cu.AmpedUp-AMP-SPP # ctrl-v ctrl-m for the ^M
screen /dev/tty.AmpedUp-AMP-SPP
cat /dev/tty.AmpedUp-AMP-SPP
minicom # via brew
chat /dev/cu.AmpedUp-AMP-SPP
From the docs:
Each dongle has the following factory default:
UART: 115200 baud, no parity,1 stop bit,8 data bits
Local name: “Amp'ed UP!’
Class of device: Misc Device
Profile: SPP (serial port profile)
Service name: “AMP-SPP”
Deep sleep: disabled
Page and inquiry scan: 1.28s interval, 11 ms duration
Security: disabled
Bonding PIN: “1234”
Bonding allowed: always enabled
I figured out where I was wayyy off-base with some help from a friend.
I thought that I was trying to establish a OSX->Terminal->Serial (Over USB)->Chip communication channel to program the chip.
When in reality, I was trying to establish a OSX->Terminal->Serial (over Bluetooth->Bluetooth) -> Chip channel to talk to the chip using the existing firmware, which includes enough defaults to have 4 GPIO/LED outputs. The USB only comes in later if I want to change the firmware.
Which means plugging the board into my laptop's USB port isn't necessary and only complicates the issue - better is plugging it into a spare USB charger next to my laptop.
... Which let me narrow down the problem to 2 things:
OSX isn't holding an open bluetooth communication channel to the BT device, so of course I won't be able to talk to it, even if the serial port is set up right
Even if I could talk to it, Apple iOS is so locked down that I won't be able to connect to it from an iPhone/iPad. :(

Communication over serial port using Bash

I'm trying to get a check-scanner to transmit image files to my Mac (the company only provides Windows drivers). I have the technical manual that specifies all the commands that can be sent to the device, and I'm trying the most basic commands first (blink the LED, print serial number, etc.).
I have been able to successfully communicate with the device using "Serial Tools", but I'm trying to use bash for more control of the input/output and to eventually write an automated script.
After reading a few other posts and trying several things, so far I've tried this:
Opening the port with stty command and various flags, for example:
stty -f /dev/tty.usbserial-A5002TeW speed 9600 cs8 cread clocal
stty -f /dev/tty.usbserial-A5002TeW raw speed 9600 -cstopb -parity -echo
Trying to send commands over echo:
echo $'LE 100\cM\cJ' > /dev/tty.usbserial-A5002TeW
--Note that the serial device is connected through a USB adaptor, but responds (at least in Serial Tools) as a regular serial device after I installed the right drivers for it.
--I'm trying to use the \cM\cJ characters because as the device was intended for use by Windows boxes I figured I should use their control codes, I've tried multiple permutations of the code.
The Problem:
No matter what happens, the device never responds (no blinky LED lights, no output, etc) and my bash shell hangs until I stop it (^C). I know I can probably use a Python library, and I might wind up doing that, but I'd like to at least see some basic functionality with the bash shell.
Another option would be to try to get it working under a VM (VirtualBox, Fusion, Parallels, etc.) by installing Windows in the VM on your Mac.
Most cumbersome solution, because you'd have to reboot all the time, dual boot your Mac into windows.
Finally, I have an app on my iPhone from my banking institution that simply uses the camera in the phone to photograph the front and back of a check, and they'll accept it that way. This might be an option.

Resources