What are the possible ways of setting custom baud rates for serial ports in Linux user mode and kernel mode? - c

What are the possible ways of setting custom baud rates for serial ports in Linux user mode and kernel mode?
I see TCGETS2/TCSETS2 ioctl calls to achieve this. Is it possible to set custom baud rates without any special ioctls?

Related

C Programming Change Serial Channel Mode from RS-232 to RS422

I am working on a software for testing serial channels on my setup running on Linux OS. To configure channel settings such as BAUD rate, parity, etc., I used functions in <termios.h>. However, I do not know how to change channel mode from RS-232 to RS-422 mode.
I tried to use functions in <termios.h> and some ioctl commmands.

STM32F767ZI interface with DAC082S085

I plan to use STM32F767ZI USART port in synchronous mode and control DAC (DAC082S085) for generating two Analog Signals. I also want to control the amplitude of these analog signals. So, how can I do in CubeMx and Keil?
Thank you

ATSAM4s8b, how to wait until a usb device has been connected

I am very new to C and embedded programming.
I simply want to have my main thread wait until a usb device has been plugged in to my embedded device.
However, no matter how hard I look, I cant find documentation or examples about how to check if the usb has been plugged in.
I am using a ATSAM4S8B.
EDIT:
Actually I think the usb capabilities are built into the chip, I can use Atmel ASF libraries.
I am hoping that there is just a library function I can call to see if the usb has been connected too but I can't find anything like it.
There are two ways of detecting USB connection:
waiting for usb events occure and special USB flags to fire in hardware registers, which will signal if initiating process started. This solution depends on a particular chip you use and firmware burnt into MCU.
use sense IO pin. Attach USB 5V through 1k resistor to a pin of the MCU. High level on the pin will indicate, that USB was connected. Dont forget to use high value (>10k) pull-down resistor, which will pull the input low when USB disconnected.

Data transfer using xbee and arduino

i have a portable device that consist of
arduino leonardo board,xbee series 2 as router( AT mode ) and different sensors.This portable device acts as a remote device and can be used upon power up.
The other side, i have a host controller that consist of arduino uno board, arduinoxbee shield v1.1, and xbee series 2 as coordinator( AT mode ). This host controller is plug through USB into my PC.
The aim of my project is to send the sensor data from the portable device using xbee wirelessly over to my host controller and displaying out on the arduino serial monitor.
I've managed to configured the two xbees. But now, i'm unsure of how im going to transmit and receive the data. I need a transmitter and receiver program for both xbees that is connected to the arduino. Anyone can help please?
There are a couple different options for how you can do this, but the simplest is to set up your sensor XBee either in change detect (IC) mode, or set a sample rate (IR). In either case you'll need to handle the RX Indicator frame at the controller, which will contain the sampled data.
I wrote a C# stack that can configure all this, but for what you're trying to do it would probably only be useful as a reference (https://github.com/jefffhaynes/XBee).

Serial port programming, baud rate related issue. port sending garbage for all baud rates except B38400

I am facing issue with serial port programming in linux. The port is able to read and write to anther hyperterminal for baud 38400. but when I try other baud rates, it fails to write and reads some garbage value. can anyone help me out.
steps I follow, store configuration initially using tcgetattr for restoring in the end.
Then configure the port . read, write. In the end restore initial settings using tcsetattr.

Resources