Does the XBee ANSI C library work with the STM32F4 family? - xbee

I am trying to use the STM32F4 family with XBee, but how can I send XBee API packets from one module to other via STM32F4?

That isn't one of the platforms supported by the XBee ANSI C Host Library, but an experienced embedded developer should be able to port that library over. It was designed to target embedded platforms down to an 8-bit Freescale with 32K of flash an 2K of RAM.

Related

Writing MIPI CSI Driver

I'm trying to mimic what arducam does https://www.arducam.com/product/arducam-1mp4-quadrascopic-camera-bundle-kit-for-raspberry-pi-nvidia-jetson-nano-xavier-nx-four-ov9782-global-shutter-color-camera-modules-and-camarray-camera-hat-b0331/
So I have got an FPGA that does combine 4 camera streams and output them into one big frame buffer CSI MIPI.
The problem right now is with the platform either Linux or TDA4 from texas instruments which don't support video4linux.
But that's not an issue, I would like to know actually how would one write a V4L driver that separates that big frame into 4 virtual cameras in linux ?
Vision Components supplies open-source linux device drivers for their line of MIPI-CSI cameras. If you need to write device drivers, you at least can look at a reference. They interface to a Lattice FPGA that they configure with i2c over a variety of platforms.
Lattice sells very small form factor FPGAs and provides a MIPI-CSI IP core you can use if you're interested in developing your own camera.
This may be a template you can explore..
https://www.vision-components.com/fileadmin/external/documentation/software/vc_mipi_driver_list/index.html
https://www.latticesemi.com/csi2rx

CMSIS-Driver peripherals

I was wandering, why there are no implementations of the devices written in CMSIS-Driver?
I mean that I have few peripherals: LCD, temperature and pressure sensor, current meter etc. - all of them very popular used in arduino and learning sets.
Each of these devices uses some protocol to communicate with the uC. some are for i2C, some communicate by SPI, some by UART. I was wondering if there are drivers that handle those devices, and as a backend use CMSIS-Driver API.
I think that it is a decent api, and after all standard develop by ARM, so why I can not find any drivers using it?
For example when I was looking for s18b20 (temperature sensor for 1-wire), I was easily able to find driver for this device written in RUST language, but I was not able to find any implementation for C that would use CMSIS. (in this case compare to rust is quite solid, because Rust has nice embedded API, and you can easily use the driver on multiple targets, just like CMSIS-Driver is spouse to work)
I was able to find some projects using this peripheral, but they all operated on HAL that is different for every uC, so the implementation is not portable ( unlike RUST, and potentially CMSIS-Driver)
So my main questions are:
Why there are so little implementations based on CMSIS-Driver? Maybe there is some hidden implementation repository that I do not know about?
Am I missing something? Is the CMSIS-Driver not designed for the casual developers? Who is it designed for then ?
CMSIS is not concerned with external devices, it deals primarily with interface drivers for interfaces on the microcontroller die. So if you have an SPI device, you might use the CMSIS. SPI driver for that part, but it is then your responsibility as a developer to write the higher-level driver for the external device.
Higher-level software platforms such as ARM's embed, or ST's CubeMX use CMSIS interface drivers, and include drivers for common higher level devices. They tend to be for more complex devices related to networking, filesystems and displays. I would not expect much support for such trivially simple devices such as a temperature sensor.

How to read USB serial input in a cross-platform way in C?

I'm trying to read serial input from a USB device with 9600 baud into a C program, but I'm not sure how to go about this. The program input will be really simple. I have a circuit set up with a potentiometer and its sending the voltage value every second over the USB.
How do I read this into a C program being developed on Windows? I'd prefer something cross-platform if possible.
I assume you are using arduino-like device, which can be easily configured to output serial data over USB. See a tutorial on the subject.
USB is not as simple as legacy serial ports and USB devices will need drivers. Class compliant devices are usually supported directly by operating system, see USB device classes, at least to some extent.
For example, if you are using Arduino, the simple way is to install FTDI drivers (see their website) and use the virtual COM port provided by the driver.
Communication over a COM port is a well-covered subject and you should be able to find a vast number of documentation over that. There are also cross-platform serial communication libraries that could make your development easier.
Then you could also write your own library for the device, but that would probably be an overkill if all you want is to read in a voltage.
You can either do something like this in your code to write seperate functions for Linux and windows...
#ifdef __unix__
...
#elif defined(_WIN32) || defined(WIN32)
#define OS_Windows
#endif
Or search for C libraries for cross-platform serial communication, here is one I found for C++ in one google search https://github.com/wjwwood/serial.

Device Driver programming - USB

I have to discuss the codeflow of the USB host controller. This USB host controller is the interface between the device and the OS. There are numerous USB devices (eg.keyboard,camera,mouse,etc).
Where will I find the code to see how the communication between the USB device and OS happens through the USB host-controller ?
Download the Linux kernel source code, and start reading the code in drivers/usb. Here an online reference, and the README about the USB-tree
I suggest you to take a look at USB host controller specifications - UHCI/OHCI/EHCI/XHCI because this knowledge will be necessary to understand whole USB stack in linux kernel.
You may also download some example sources provided by several embedded microcontroller producers (i.e. Atmel). Probably those drivers will be easier to analyse than linux sources.

How to do this: embedded USB-Host communication with plugged USB-Device

I am currently practising with USB programming on an AT91SAM9G20-Evaluation Kit. I learned much about USB devices and USB device port drivers while "playing" with the ATMEL provided USB device port projects (CDC-driver, ..).
But now I'd like to write a small driver to controll a wireless stick
which I plugged into one of the boards USB-A Host Ports.
I read a lot on Stack Overflow, the OpenHCI specification and even found some libraries on the net, but I am not sure if it's a good way to implement my own stack without any "good" knowledge in USB Host Port programming.
Is there a small and easy way to control the wireless-stick at the boards USB Host port? (like using the USART-Interfaces?).
I am also keen to hear hints on how to implement RTUSB or libUSB in to the AT91.
You can download AT91LIB version 1.9 from atmel from this page
The usb host libraries are under at91lib/usb/host. They're not the complete package you need though since they're just the OHCI driver -- you still need a USB driver and class drivers to implement what you want.
You could try an RTOS with USB Host support like rt-usb32

Resources