Sending serial data without RS232 port - matlab

I want to send data serially from MATLAB, but my laptop doesn't have a serial port. Do I have to use a USB-to-RS232 converter? Will my program remain the same?

I have some RS232-USB-Converters and never had any trouble. I need adapters for embedded devices and embedded development.
If your driver is properly installed and works then it is presented as an serial device to the OS.
The device presented (on linux) is named differently (ttyUSB) but that doesn't matter.
And using stdio functions like fopen/fclose is one more layer above (libcall, not syscall).

Related

Flutter and Iot devices

I am currently building an app that controls a single actuator and a LED strip. The controller for the actuator and LED strip is based on an ESP32.
On the ESP32 I have used the <ESPAsyncWebServer.h>, <ESPAsyncWiFiManager.h> to set up and connect the ESP to the local wireless network. In the app I would like to send some commands to the ESP like http://<ESP32_IP>/led_set?level=<level> and
http://<ESP32_IP>/act_open and so on, this shouldn't be an issue.
Normally I would set up mDNS on the ESP and in the Flutter app, however several of the ESP controllers are already shipped to the customers. So I am looking for another way to identify the ESP.
At the moment I have used the ping_discover_network library and the ESP shows up fine on port 80. I am however not able to separate the ESP from the other devices that shows up on port 80.
Do any of you have any suggestions?
Thank you in advance
You don't have many good options. If you only want to identify a few devices which have slipped through your fingers without mDNS, you can use their MAC address as a filter. If you happen to know their individual MAC addresses, then that should be quite painless. Otherwise you'd have to look for devices with MAC OUI (first 3 bytes, usually) ranges allocated to Espressif. Espressif has several OUI ranges, but if your devices were from a single batch of ESP32 module of the same type, they'll be using the same OUI so it should be quite easy to figure out.
E.g. a batch of modules I have all start with 40:F5:20:...
Of course, if a third party installs their (unrelated) ESP32 module into the same network, you'll have a chance of identifying those as well, but such is life.
This is obviously a stop-gap measure. Make sure further devices go out of door with some identification (mDNS or otherwise).

How to receive CAN data in a linux device driver?

I want to read the CAN bus and get the data from a specific device on the CAN bus. I have implemented this previously using the Socket communication api that is available in the user space (sys/socket).
I now have a similar requirement but this time working on device drivers which work in the kernel space. The same socket communication is i suppose not available in the kernel space which is why i guess i am not able to compile the kernel module with #include .
An approach i have come up to is to create a device driver for device creation and a supporting user-space program to interact it and provide CAN data by using socket communication. If there is any better approach please suggest me.

How to flash without STLINK

My STLINKV2 is not working anymore, not detected by Linux, it failed after the first successful flash. I ordered a new one but it will take 60+ days to arrive. Meanwhile I have heard on Youtube you can program Bluepills directly by connecting cut open USB cable to certain pins and then using a jumper. But I cannot get any precie information on this, is this really possible and how?
You should use the embedded bootloader. You can flash it through several interfaces. Look at AN2606, maybe you can find an already written flasher. Good luck STM32CubeProgrammer handle it.
If you intend to program it through usb, look also at AN3156 all protocols document are referred in chapter 2 of AN2606
THOSE AREN'T CUT OPEN USB CABLES they are USB to serial adapters for arduino's bootloader
They connect them like this:
The problem is that this requires the Arduino STM32 bootloader to be flashed in it.
Another option will be to use STM32CubeProg this program allows you to program your stm over
Serial
SPI
I2C
USB
You'll need to set the BOOT0 and BOOT1 pins to the correct value (HIGH slash LOW) to allow it to go in flash mode during boot.
Here is semi outdated tutorial which tells most of the steps to program a STM using serial. (the Flash Loader Demonstrator is outdated and you should use STM32CubeProg)

Multiple Serial connection from Arduino to Qt Creator and Matlab

I am currently doing a project that uses this 3 softwares. Qt, Arduino Uno and MAtlab.
In my project, I was planning to use Qt to transmit an input value into Arduino in which Arduino will give a feedback in return, in which the feedback output is serially received by Matlab.
I have tried performing the serial connection, unfortunately Arduino Uno can only initiate serial connection with either one of them, and not both.
Is there any way to perform multiple transmit/received method between this Qt-arduino-Matlab serial connection?
Thank you for your time and aid
If I understand correctly, you have an Arduino device as serial port, and you want to communicate with it from Matlab and Qt simultaneously under the same host computer.
Under Windows, there seems no simple solution, unless you write some low level code to open the device with special share mode.
Under unix, you can open the serial port from Qt (it seems this works for you), and if needed, you start Matlab as sudo, so you have full control over the serial port, which allows you to open it again.

reading text message through matlab using AT commands and bluetooth

I want to read text message using Matlab as hyperterminal using AT commands and bluetooth as connection medium since I am new in it could somebody suggest that how can I do it.
I am using nokia c2-03 for sending the message but if you suggest any other phone i can that too
I connected my phone through USB, saw the Port name then connected it through matlab using
s=serial('COM1');
and then opened the port
fopen(s)
now I don't know what to do I mean now how can send at command to control the device.
PS I am sure that my device supports serial communication.