Beaglebone Black ADC sampling with libpruio - c

I'm doing a project on a Beaglebone Black where i need 4 ADC channels to sample at 40khz each. I have installed the libpruio library and able to sample the ADC channels.
My question is how to set up timer interrupts on the board to get that specific sampling rate. I cannot seem to find good documentation to do so.

Timer interrupts are slow. libpruio is designed to read the samples from a ring buffer. Configure sampling in RB mode and check the counter.
Find an examples and further information by googling for:
libpruio "rb_file"

Related

Using I2C on XMC1100 2Go

I recently got the Infineon 3D Magnetic Sensor 2Go development board (based on the XMC1100 microcontroller) and I would like to know how to read input from the 3D Magnetic Sensor which is interfaced through I2C. I am new to the Infineon development system, so I do not know how to gather and process input from the sensor.
Here is what I know so far:
The main microcontroller is an Infineon XMC1100-Q024F0064
The 3D Magnetic Sensor is connected to the XMC1100 via I2C
How to program and control the GPIO on the XMC1100
How to use the supplied stand-alone applet to view data from the Sensor
I have the DAVE IDE, the APPs extension, and I am writing my code in C. I need to use DAVE to accomplish my desired end result, but I would be interested to know the Arduino method as well.
Thank you in advance for your help!

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.

LPC2148 ISP not working after flashing a hex file

I am new to ARM programming and started out with NXP's LPC2148 chip. I am using it's on chip ISP UART bootloader. The loading was working perfectly at 9600 baud with 8 bits and even parity.
Then I flashed a code made by a new project on LPCXpresso through the Flash Magic firmware at 14400 baud. After that the bootloader sequence does not work anymore. I have tried every possible baud rate with odd and even parity but it doesn't work anymore. The common problem saying "Autobaud failed" is coming up and weirdly the chip is warming up a bit when the power is on.
The worst question that is hitting my head is whether I wrecked the ISP bootloader.
PS. I have been using a 16MHz crystal. Although the code that I inserted in it was actually made for a 12MHz crystal with PLL adjusted at 5 multiple (60MHz). But the bootloader initializing sequence should bypass the normal code on chip isn't it?
Please help me

Conflict between LED driver and analog to digital conversion on Arduino

On the Arduino Nano V3, I am trying to get an LED driver (TLC5960) and two analog to digital (ADC) converters (MCP3208) to work together. The LED driver is on the same pins as this guide. The ADCs are assigned to different pins than the LED driver. I found that the LED driver conflicts with the SPI communication interface according to the comment:
Tlc.init(); //interferes with other SPI
but I'm not sure what to do about it since if this is not called, the LED driver does not work. It seems to be true, however, since if I comment out all of the LED driver related lines in my code, the ADCs work.
Also, I am using bit banging to communicate to the MCP3208.
If you look at the code, you'll see that tlc_config.h contains options relating to the communication and connection with the TLC'. Simply edit the options within that file to suit your needs.

Controlling voltage supply on usb port using c or any programming language

I don't have much konwledge in electronics. i wanted to turn on/off led connected to usb port using program. usb port consists 4 line (data+,data-,voltage ,ground) if i connect voltage and ground lines to led , it will glow. i've been searching on internet this issue and i find that it is not possible to control led connected to usb using program because supply over datapin is too low which can not be used to tun on off led.
but what if i connect my led to vol and ground pin and control the entire power supply of usb port , i guess it is possible to control led using program. there is a way to disable and enable power supply over usb port.
i also want to know is it bad to follow this approach. does it damage usb controller to frequently enable/disable power supply.
Algo :
a = Get_input_from_user() ;
if(a=="ON")
turn power supply of usb port ON.
else
turn power supply of usb port OFF.
this thing is certainly possible using extra hardwares, i don't want to use any extra hardware.
The power for a computer's USB ports is generally not software controllable. In most cases, the power pins of your USB ports are wired directly to the 5V rail of your power supply (usually through a polyfuse), so there is no way to switch them on and off.
Some powered USB hubs do support switching power to their ports, but you said that you didn't want to use any extra hardware, so you're out of luck.
you can use any basic Arduino board to do this there is a complete IDE free and a LOT of sample code that will do what you want out of the box
you can also use a COOL board.
Arduino Compatible code is available for the Teensy
Software Development Tools HERE
You can use an external power supply (the Vcc and GND pins of the USB port in this case) with a resistor to power the diode and connect a transistor in the middle working as interruptor. Then, yo connect the base and emisor to de data+ and data- of the USB port.
this page doesnt let me upload images.
Sorry for the quality of the drawing but all I have on the computer is paint.
For a more stable performance make sure to make R1 low enough so that transistor is on saturation mode when data pins are ON but not so low that transistor gets burnt (I dont really know what is the voltage level of the data pins on the USB port, sorry).
To choose a proper value of R2, you need to know the current you need to power your diode. It's calculated acording to Ohm law:
Idiode = (Vcc - Vce,sat - Vd) / R2.
Where Vce,sat is potencial diference between colector and emisor when transistor is on saturation mode (it is found on the transistor datasheet on the manufacturer webpage, usually around 0.2V) and Vd is the normalized potencial difference of the diode (the same, but this time around 0.6V).
Note that data- and GND pins are connected. I am 99% sure that this won't harm your USB port, but use it at your own risk.
I would test it out using another external power source first anyways, just to make sure you connected everything properly.

Resources