While working on one RN4870 modules, I came across this problem. How do you set the module into command mode when it boots? What is the command set to get it connected to another module automatically onces it boots.
I tried to make a script in Python to do this.
$$$
+
LB
C,0,82938DFF897 (C, public/random, address)
Both of them have been bonded and upon boot I have to connect through UART and go to command mode and try C2/C3 to connect one another. Is there a GPIO configuration to do the same? I'm kinda new to this module any help appreciated.
Your command should be ok
$$$ enter command mode
You need a delay to enter in command mode
LB ( I think you don't need the list of bonded device)
C,0,MAC ADDRESS is correct to connect to the remote bluetooth device.
I use then CI to start client operation
LC to read all the service and chracteristics
CHR Handle to read
CHW Handle to write
I hope is useful
Best Regards
Related
I'm trying to send this sequence below over asyncSSH
Enter(Carriage return)
~m
I have tried that with interactive ssh using the OpenSSH server on Ubuntu 18.04.
OpenSSH has Tilde as an escape character so I send this. Tilde two times. And it works as expected.
Enter(Carriage return)
~~m
but I have tried to send the same sequence with multiple approaches but it doesn't make any effect on the ssh shell using asyncSSH library.
I have tried all these sequences below
self._conn.send("\n~m")
self._conn.send("\n~~m")
self._conn.send("\x0d~m")
self._conn.send("\x0d~~m")
For Reference, you can check where this sequence originates and is needed on open-gear devices.
https://opengear.zendesk.com/hc/en-us/articles/216373543-Communicating-with-serial-port-connected-devices
When connected to a port, use the chooser escape sequence of <enter>~m
Brief Explanation about the scenario,
Opengear is a device that connects to the console of network devices. when I connect to the device console port for going back to the menu to select another port I need to enter this sequence.
Any help sincerely appreciated. Thanks
What I put into my otherwise mostly empty main function was basically:
import uos
uos.dupterm(None, 1)
I uploaded this code to my microcontroller and it stopped being able to connect to my computer. My aim was trying to connect to a Bluetooth module (ZS-040). Now I can't even connect to the microcontroller.
I was intending to make a serial connection to the Bluetooth module while keeping the UART0 bus separate for USB and REPL connection. Now, I am stranded, having done quite the opposite. How do I fix this?
If you have enabled the webrepl, try using it to connect & upload a new, blank 'main.py'.
https://docs.micropython.org/en/latest/esp8266/tutorial/repl.html?highlight=webrepl
(this works on my ESP8266 after running dupterm(None, 1)). Failing that, re-flash the firmware to erase 'main.py' and re write the script to either issue dupterm manually at the start or to issue 'dupterm(UART(0, 115200), 1)' after some later event to re-attach the repl.
I've a device which is supposed to send data via a usb connection. When I connect my laptop via usb to this device and open a terminal I get sone weird characters and are printed as a command line. However I haven't configured anything.
If I try to connect to the device via serial port initializing it I cannot know which port is? Plugging ang unplugging the device shows no difference in the result of:
>ls /dev/*
Which seems the device is not detected, but as I said in the command promp or even if I use any other application, it is as if I was writing, but random characters
Does anyone k ow why does it happen?
How can I set communication characteristics to be able to connect to the device at a certain baud-rate?
The idea is to get data via Python.
Lots of thanks ;)
I am using a telit he910g card. it is connected to my PC directly using a miniPCI slot.
I am using it for 3G internet connection and A-GPS/GPS services.
My system is running linux mint 17.1, the 3G connection is handled using the network manager APP and works great. The 3G connection is started and handled using a module that is part of a program I am writing.
The code I am using in order to connect to the serial port is this:
def _connect_to_device(self):
""" Connect to a serial port """
try:
self._device = serial.Serial(self._filename, baudrate=self._baud_rate)
except StandardError, e:
raise StandardError("Couldn't connect to GPS device. Error: %s" % str(e))
When I use the python program alone it works great. But when I try and use it while the 3G is on i cant connect to the serial device. The wierd thing is that if I try to connect to it using a program like "minicom" while 3G is turned on it DOES work.
So my question is: how can I make both run and work together? since now they are mutually exclusive.
thanks to all who help. :)
Glad you found a way round your problem. Just for completeness:
Normally, serial ports can be opened by multiple processes.
If one of them does ioctl(,TIOCEXCL) on the open file then further opens will return EBUSY until everyone closes the device. Only root can get past this and open the device at all times.
If root opens the device and does an ioctl(,TIOCNXCL), then other processes can open the device too.
In python, TIOCNXCL isnt defined anywhere, but you can do the ioctl (eg on stdin) with:
import fcntl
TIOCEXCL = 0x540c # from /usr/lib64/perl5/asm-generic/ioctls.ph
TIOCNXCL = 0x540d
print fcntl.ioctl(0, TIOCNXCL)
Ok, so it is solved.
the issue was that the telit module has 2 ports /dev/ttyACM0 (high speed) and /dev/ttyACM3 (lower speed).
I tried to connect to the high speed one, but apparently the 3G uses that one and it causes contentions.
So moving to use the lower speed port in my script solved the issue.
I am using a Beaglebone Black (BBB) with Python and pyserial to communicate with an OBD-II reader. I am essentially trying to build a customizable digital gauge panel. Ideally I would like to use Flash for the GUI. Sadly Linux support for Flash is pretty weak. I would like to be able to send data from the BBB using Python to a OSX host computer.
I am currently using terminal to shell into the BBB to run code. I would need to be able to send data from the BBB via a USB/serial interface to the OSX computer running Flash. What would be the best method of accomplishing this?
I have not used beaglebone. I have worked with arduino's serial I/O. But this post says you have multiple serial I/O ports on BBB. Find appropriate connectors/convertors for serial to USB.
Then use the pyserial python module.
On OSX, you will find your device when connected on a path like /dev/ttyo1 where dev is my system name and ttyo1 or something similar will be your device.
import serial as s
device = "/dev/tty01"
bbb = s.Serial(device, 4800) #the second param is baudrate
while(True):
bbb.readline()
# do what you want with the output.
bbb.write('input')
This will read till the end of line character and give you a string. and then write "input" to the serial io on bbb. You will need a similar program running on BBB to read this input and do what you want to do with it.
So there will be two python programs. One on the OSX and the other on the BBB
That way you can give commands from OSX.py, let your BBB.py process and send a response. Which the OSX.py will read and do what is to be done.
You will have to design the input/output cycle properly.
Also if flash is not really necessary you can check out pyside.