How to add LAN and RS232 in yocto - arm

I have generated an Image(fsl-imx-x11 distro) from yocto but it doesn't contains LAN and RS232 terminal.
I would like to know where I can find its packages?
Is it also added same as recipe creation?
do I also need to change dtsi file?

I think what you might actually need to do is Pin Muxing on the the Board whereby, you need to add appropriate muxing of pins to activate the LAN and RS232 on the board.
For this you need to look into the board's Device Tree.
Refer to the Board's Documentation for Pin Muxing or Device Tree sections.
Find the respective .dtsi file in your $BUILD_DIR/tmp/work/<board-bsp>/arch/arm/boot/dts/
within the file you might need to enable pins under the &iomuxc{} structure.
at the bottom of the file you need enable the status flag to okay.
&eth{
pin-ctrl="..',
status = "okay"
};
You need to recompile the kernel:
bitbake -f -c compile; bitbake your kernel
or create a new image
Note
there is a sophisticated way of doing this by appending your Device Tree files in recipe and using devtool but for that you need to look into the Mega Manual

Related

Reading sound card data on RaspberryPi using C

I want to read the data generated by USB sound card connected to my RaspberryPi using a C code. The samples should be stored in an array or are written to a csv file.
I am using ALSA library through a function "snd_pcm_readi". Can someone explain how to access the data read by "snd_pcm_readi"?
Or is there a better alternative?
Look at the libusb library, https://libusb.info/
This library gives you simple C functions to find and open the device, and then send and receive data. You may want to do some reading about USB devices.
You may also want to look at udev - you can write a udev rule to symbolically link the desired device to a known filename.
You may need to know the vendor_id and product_id. At the command line, enter lsusb to see the usb devices.

Modifying DE10-nano default FPGA configuration

I am working with Linux software on DE10-nano board and I need to perform a small modification to default FPGA configuration (add pull-ups on GPIO lines).
The user manual points to DE10-Nano System CD\Demonstrations\FPGA\Default as default project which suppose to produce the factory FPGA configuration.
I compile it, convert SOF to RBF, and put the RBF on SD card for U-Boot to load.
U-Boot programs FPGA (I get orange LED on) and then fails to load Linux device tree (I get ERROR: Did not find a cmdline Flattened Device Tree message via COM port) although the same device tree file is in the same place on SD card.
Am I using the correct Quartus project?
The only solution that worked for me (loading my own .rbf file with the unmodified Linux Angrstrom from Terasic) was to use the SD card images from:
http://download.terasic.com/downloads/cd-rom/de10-nano/linux_BSP/
I used the de10_nano_linux_console image. I used the sof_to_rbf.bat file to generate the .rbf file, ensuring that compression was turned on and the output file name was soc_system.rbf.
Any other method I tried with the SD card resulted in the error message the OP posted relating to the Device Tree.

parallella fpga : how to give an interrupt from pl to arm ps

I successfully implemented an "[accelerator in 15 minutes]"1 on parallella board. Now I need to send an interrupt from pl to ps. So I connected it to IRQ_F2P of Zynq processing system.
Now, how can I get this interrupt in arm processor?
Usual interrupt example using "XILINX SDK" tool which uses a JTAG. But in parallella , I don't have a JTAG. (I am coping the program to SD card and execute it from SD card using Ubuntu). So any suggestions are most welcome.
So for parallella, I tried to use the Xilinx SDK, but the header files are creating an error..
My one more doubt is "Is it possible to create a bsp using sdk tool and copy it into sd card and then make it run on parallella board. Will it work ?
If not, how do we get this interrupt in arm processor, because all example uses Xilinx header files like "xparameters.h, xil_printf.h, xcugic.h, etc" and these are connected to many other Xilinx functions.

Programmatic ALSA loopback

I need some pointers where to start with the following:
From any application that plays audio using ALSA to the connected speaker I'd like to grab the samples and do some audio processing.
I am not in control of the player and I'd like to be able to process the audio from any source. Basically it will be an UV-meter, perhaps later with FFT (all just on the command line). Additionally I'd like my app to be self-contained.
In my research I've found:
There is a loopback kernel module.
You can do fancy stuff with the configuration file.
There is the ability to create plugins.
Using the kernel module and altering the configuration file introduces some dependencies of my application to the configuration of the system.
And creating a plugin I give up control over the app and cannot start/terminate it whenever I want.
This is not satisfactory to me so I'd like to know if there is a way to either:
create a loopback device programmatically
or is there any other way to read from the pcm playback device other applications are writing to.
You can use the pulseaudio for linux where you can very easily create a loopback device .There ia a pactl command -it will help you create a null sink and you can loopback from it .
something like this
//this would create a null sink with specified channel conf
pactl load-module module-null-sink sink_name=sink6ch format=s16le rate=48000 channels=6 channel_map=front-left,front-right,front-center,lfe,rear-left,rear-right
//make it default
pactl set-default-sink sink6ch
you can use its monitor device to read about the monitor devices of pulse audio

Detect certain connected USB device

I'm working with a USB device in Linux and have written a library to control this device.
Without going in to TOO many details, the device uses a standard UART protocol, so all I have to do is open a serial connection with open, configure the relevant parameters like baud rate, stop bit, parity, etc, etc, and start bit-banging registers.
The library works fine, however, it its hard coded to assume that this device is /dev/ttyUSB0. That is, this is what I pass to open. If open fails, I exit.
What I would like to do is detect that this device is present, regardless if it's /dev/ttyUSB0, /dev/ttyUSB1, etc. And even detect if there are multiple of these devices connected.
I can write code to poll certain registers on the device that will return serial number, product ID, etc, so I can detect that what is on the other end of the USB is indeed my device... but how can I find a list of connected USB devices, again, in native C?
OR is there a more elegant way of doing this, such as interfacing with it's kernel module, or something? I can provide the USB driver it actually uses, but I'm sort of lost when looking through the code.
Thanks for any insight.
The elegant method is to use udev to create a descriptive symlink for your device when it is connected. Add a line something like this to /etc/udev/rules.d
SUBSYSTEM=="tty",ENV{ID_MODEL}=="My_FlowMeter_Model",ENV{ID_USB_INTERFACE_NUM}=="00",SYMLINK+="flowmeter",RUN+="/bin/su pi -c /home/pi/record-flowmeter.sh
That's a very slightly modified version of an actual udev rule my research group uses to collect data from USB devices connected to battery-powered Raspberry Pi boxes. It also runs a script automatically, which has commands like
stty -F /dev/flowmeter 500000 -ixon -echo -icanon
If you want to know the "real" device filename, you could do readlink /dev/flowmeter. But for most uses you can just use the link: fd = open("/dev/flowmeter"); (or pass it as an argument to your program)
Naturally you should replace flowmeter with a short name for your own device, as well as updating the ID_MODEL based on the output from lsusb.
Multiple devices are a bit more complicated, but there are plenty of examples of udev rules out there.
On Linux, the information you are looking for is in the /sys filesystem, specifically under /sys/bus/usb/devices. From there you will need to search the filesystem to find your device.
For example, I just plugged a USB-serial dongle into my Linux (kernel version 2.6.35) and the device appeared under /sys/bus/usb/devices/2.1-8. Here, I am able to find that this is my device by vendorId:deviceId by checking the files idVendor and idProduct. Here, there is a directory named 2.1-8:1:0 which contains a directory named ttyUSB0.
Obviously, to find your device you will need code (or a shell script using find) to scan the directory tree, looking for the right entries.

Resources