How to turn off USB Power completely on RPi B3+? - raspberry-pi

What I am trying to do is:
Programatically I want to switch on and off the USB power of the RPi B3+ or 4 models.
I know that I can put 0 in /sys/devices/platform/soc/3f980000.usb/buspower but seems like it does not work as expected.
Let me show you what all things I have tried:
Check 1:
Connect USB device (In my case, its camera) to the Rpi
Fire command "lsusb" In the list,
I get my camera listed properly
Check 2:
The camera is connected and lsusb is showing the device
sudo vi /sys/devices/platform/soc/3f980000.usb/buspower and put 0 in it and save the file
again lsusb
All the connected devices list is gone. Looks like its working
BUT:
When I put voltage meeter on the usb port(As showin in screenshot) , it shows same current flowing through the USB ports.
Refer attached screenshot below to understand this issue.
Looking for the solution if anyone knows.

Related

STM32H7 DCMI with BT.656

I am currently making a system using digital camera, my camera resolution is 384x288 4:2:2 YCbCr. My camera works on BT.656 with embedded sync (without hardware sync).
I configured STM32 DCMI with embedded sync and it didn't work. Then I started to debug it and found some weird STM32 DCMI issue:
STM32 DCMI embedded for BT.656 is inverted.
STM32 DCMI document (out of ST's
AN5020):
BT.656 Protocol (from
here):
I have 2 questions:
Has anyone been able to make BT.656 work on STM32H7 or any STF32FXX?
BT.656 resolution for PAL is 720x576 but my camera is 384x288.
What is the format of the camera?
Or: How can I understand how many lines are used?

STM32: STLink won't connect through SWD any longer

The first flashing went fine, subsequent flashings fail with
Error in initializing ST-LINK device. Reason: No device found on
target.
On an STM32H745 NUCLEO board I have enabled the DEBUG interface and SWO pin by mistake. Is there a way to hard reset this board ?
The "flashing under reset" trick did not work. That is, holding the reset button pressed and immediately releasing it before STM32_Programmer does its thing through ST-Link. A bit of RTFM-ing sometimes helps:
If a deadlock is faced due to a mismatch between the HW
board setting and the FW setting (LDO/SMPS), the user can
recover the board by doing the following:
- Power off the board
- Connect CN11 ‘BT0’ pin (BOOT0) to VDD using a wire
- This changes the BOOT0 pin to 1 instead of 0 and thus the
device boot address is changed to boot address 1 making the
bootloader starting in System memory, instead of starting the
FW in the user Flash (FW that is setting a wrong LDO/SMPS
configuration)
- Power on the board and connect using
STM32CubeProgrammer
- Erase the user Flash
- Power off the board and remove the wire between BOOT0
and VDD
- The board is now recovered and can proceed normally.
Now I got to figure out why it goes deadlocked as soon as I flash my bin... commented some bits of code and rebuilt, sill does it.
LE: found the offending lines:
HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
...
My SystemClock_Config function was all written for LDO power instead of SMPS

VLC loop/repeat not seamless when running in remote command mode

I have a Raspberry Pi 4 running Raspbian and run VLC from a command prompt with the following parameters
vlc --intf rc --rc-host localhost:65513 --fullscreen
I have successfully gotten VLC to play a video by issuing remote commands through a Socket and have issued a repeat/loop command.
The looping doesn't have to be seamless but it momentarily cuts back to the command prompt before it replays the video and looks unprofessional.
Is there any solution to this? I cannot find anything that works. I can live with the screen staying black for a moment but can't have work presentations playing continously on a screen that shows Linux in the background every 30 seconds.
I had the same issue, here is how I "fixed it" :
set desktop background to a black jpeg.
Told the panel not to appear at launch by editing /home/pi/.config/lxsession/LXDE-pi/autostart as follow (first line that launchs the panel is commented to do so) :
##lxpanel --profile LXDE-pi
#pcmanfm --desktop --profile LXDE-pi
#xscreensaver -no -splash
Prevent the pi to blank screen or go to sleep by editing file /etc/lightdm/lightdm.conf and adding in the [SeatDefaults] section :
xserver-command=X -s 0 -dpms
Now when VLC is looping, it still cuts back to the desktop but as everything is blacked out (no panel, black background), the cut becomes invisible.
Et voilà :)
My best.
S.Y.
I solved this by using two instances of VLC, whereby one instance streams the video to the other using the --sout-keep flag. This way the VLC instance actually producing an image shows a continuous stream, as the streaming instance tries to keep one stream instance open across multiple(or one looped) file.
For example:
vlc rtp://127.0.0.1 --intf dummy --fullscreen --no-video-title-show --alsa-audio-device hw:1,0 &
cvlc file.mp4 --sout "#rtp{mux=ts,dst=127.0.0.1,sdp=sap,name='somename'}" --sout-keep --loop
The same happened to me some month ago, it looks that the only one solution is to wait for the release of vlc 4.0 for raspbian too, and no plans about it.

Output analog and hdmi sound over ALSA on RPi3

I'm trying to setup my Raspberry Pi 3 in such a way that both analog and hdmi audio are working in Kodi simultaneously with ALSA. So the driver should be ALSA (in that way I should be able to use the LADSPA plugins to delay the analog stream (next step) :-)).
I've been crawling Google for quite some hours now and I don't understand how to setup ALSA correctly.
The only way I'm getting both analog and HDMI audio is by selecting that option in Kodi but the stream must go through ALSA (which it does not in that case). Does anyone have a clue how to set this up?
The hardware in the Pi seems be setup as follows:
Analog sound: Card 0 Device 0
HDMI Sound: Card 0 Device 1
For now I'm only able to switch the output between analog and HDMI with this command:
amixer cset numid=3 1 > analog audio
amixer cset numid=3 2 > HDMI audio

Android things driver for AR1100

i try to connect lcd with touch panel AR1100 to Raspberry pi3 with Android things. Android does not have driver for this touch, i found this solve:
create file:
/system/usr/idc/Vendor_04d8_Product_0c03.idc
and write:
# This is an example of an input device configuration file.
# It might be used to describe the characteristics of a built-in touch screen.
# The device is a external device.
device.internal = 0
# The device should behave as a touch screen device.
touch.deviceType = touchScreen
# The device uses the same orientation as the built-in display.
touch.orientationAware = 1
But after restart touch not working. What wrong??
How i can connect this touch to android things?
In your Android Things application (not on Android Things system level) you can add AR1100 touch support via Raspberry Pi UART by implementing AR1100 Data Protocol (pp. 14-15 of datasheet):
The host should be configured for 9600 BAUD, 8 data bits and 1 Stop
bit.
...
Touch reports always originate from the AR1100 and are
transmitted in response to touch detection. The format of the
touch report is mode-dependent. The measurement resolution for
touch coordinates is 10-bit. The measured values are shifted
(multiplied by 4) and reported in a 12-bit format. In the
reporting protocol, the Least Significant coordinate bits X1:X0
and Y1:Y0 will be zeros. The resulting full-scale range for reported
touch coordinates is 0 to 4095.
...
The ‘standard’, 5-byte touch report is formatted as in Table 4-2:
etc.
Android Things UART example you can find here.