Stm32 spi write on rising edge and read on falling edge, possible? - stm32

i have application ic which needs to write on rising egde and read on falling edge . Write now i get both on rising egde?
I am using bidirectional mode so only 3 wires
Thanks

needs to write on rising egde and read on falling edge
Look at the SPI timing diagram in the Reference Manual. (This is for the F4 series, but AFAIK other series have compatible SPI controllers)
It does what you want when CPHA == 1 and CPOL == 0. Data lines are written at the rising edge, and captured at the falling edge of SCK.

Related

Why is 'GPIO.setup(6, GPIO.IN)' throwing an error?

I'm trying to read the state of the input pin (BOARD pin 6, which is a ground pin) and I receive the error "ValueError: The channel sent is invalid on a Raspberry Pi".
Am I misunderstanding the definition of an input pin? My understanding was that it is simply the ground/negative pin, connecting back 'in' to the pi?
I'm trying to read the state purely for tinkering purposes, to see the value change when it's floating (not using a pull-down).
The Ground pin is connected, literally, to ground. It is impossible to read or write values to ground or power, as these are the circuit components. You have to connect to a GPIO pin (the green(ish? I'm colorblind) dots at http://pinout.xyz).
It is possible for the input of a GPIO pin to be set to HIGH or LOW, depending on the circuit you wish to use. If you expect the GPIO to be normally LOW and HIGH when your input is triggered (such as with a pushbutton switch), then you have to set the state to pulldown.
I would recommend you read some of the background on microcontrollers: https://embeddedartistry.com/blog/2018/06/04/demystifying-microcontroller-gpio-settings/

How to use IR leds that is not working on Pi camera

For a night vision camera, I bought NoIR Pi camera and IR leds(Can be attached to both sides of the camera).
But I found that my Pi camera doesn't have metal part on the attaching part. So I cannot use my IR leds with pi camera. Can I use it with pi's gpio? Actually I only need to turn on the leds, so I wonder if I can supply power to leds with raspberry pi or arduino's pins.
Additionally If I connect the leds with jumper cable or something, should I solder it or is it okay just tying it.
You can connect your leds to any DC power source, just be sure to limit the current by using a suitable series resistor to avoid destroying your leds. And don't look into them to prevent eye damage, as your eyes will not accomodate to invisible light.
In good approximation:
I = U / R
with:
I is maximum allowed current trough LED (ampere)
U is power supply voltage (volt)
R is value of resistor (ohm)
Or more exact:
https://www.sparkfun.com/tutorials/219

Head movement detection using 1 accelerometer

I've been assigned a small project of designing a turning jacket for cyclist, which is used to indicate when the cyclist turns right or left using LEDs attached to the back of the jacket. I plan to use 1 accelerometer to detect the head movement. There are simply two kinds of movement: left and right. Is it possible to use 1 accelerometer to specify the movement of the head?
Thanks!

RC Filter at the ADC input pins of beagle bone black

I am trying to read a thermistor with the beagle bone black.
I have a voltage divider circuit that feeds a unity gain Opamp. The O/P of the opamp is connected to a simple RC Low pass filter that feeds voltage to the ADC pin.
The problem I have noticed is that the voltage sensed by the beagle bone is always 0.02V higher than the actual voltage at the opamp output.
At first I thought this was a software issue, but on further investigation I found out that the voltage at the ADC pin is actually raised by 0.02V. If I feed the ADC pin directly from the opamp, without the RC filter I do not have this issue.
Has anyone else experienced anything similar?
Thanks in advance!
The resistance in the RC filter is too high which is causing a voltage drop because of the internal impedance of the ADC pin. You can use an active low pass filter to resolve this problem:
http://en.wikipedia.org/wiki/Low-pass_filter#Active_electronic_realization

How does multitouch IR touch screen work

I am doing research on touch screens and I couldnot find a good source except for this image below which could explain how multitouch IR systems work. basically the single touch IR systems are pretty simple as on two sides of the panel, lets say left and top are the IR transmitters and on the right and bottom are the receivers. So if a user touches somewhere in the middle, the path of IR will be disrupted and the ray will not reach the receiving end, therefore the processor can pick up the coordinates. but this will not work for multitouch systems as there is an issue of ghost points with this approach.
Below I have an image of 'PQ labs' multitouch IR system working, but as there is no explanation given, therefore I am not able to understand its working, Any help will be greatly appreciated.
I consider that they have a special algorithm to avoid the point caused by the inner cross of emitter light. But this algorithm will not work for every time, so sometime if you put your finger very close to each other. The ghost point may will show up.
My guess:
The sensors are analog (there must be an Analog to digital converter to read each of the opto transistor (IR receiver).
LEDa and LEDb are not on at the same time
The opto transistor are running in a linear range (not in saturation) when no object is present.
One object:
4. When an One object is placed on the surface. There will be less light accessing some of the opto transistors. This will be reflected by a reading that is lower then the read when no object is present.
The reading of the photo transistor array (it is an array reflecting the read from each opto transistor) will provide information about:
4.1. How many opto transistors are completely shaded (off)
4.2. What opto transistor are effected
Please note: A reading from one LED is not sufficient to know the object position
To get object location we need two reading (one from LEDa and one from LEDb). Now, we can calculate the object Position and Size since we know the geometry of the screen.
Two Objects:
Now each array may have "holes" (there will be two groups) in the shaded area. These holes will indicate that there is an additional object.
If the objects are closed to each other the holes may not be seen. However, there are many LEDs. So there will be multiple arrays (one for each LED) and based on the presented geometry these holes may be seen by some of the LEDs.
For more information please see US patent#: US7932899
Charles Bibas