Jump to content

Levent Erenler

Members
  • Posts

    24
  • Joined

  • Last visited

Posts posted by Levent Erenler

  1. On 11/21/2020 at 4:41 PM, @lex said:

    Can you post the format info for your USB camera?

     

    v4l2-ctl -d 4 --list-formats

    or

    v4l2-ctl -d 5 --list-formats

     

    I have seen some USB camera has a YUY2 format.

     

    Cpu usage ~52% looks good for OpenCV.

     

    Sorry @@lex for late reply, i did not see any notification until last message. Thank you

    usb camera formats are;

    ioctl: VIDIOC_ENUM_FMT
            Type: Video Capture

            [0]: 'MJPG' (Motion-JPEG, compressed)
            [1]: 'YUYV' (YUYV 4:2:2)
     

  2. On 11/16/2020 at 4:50 PM, @lex said:

    I would build opencv with debugging info and try to find the bottleneck. And why there is an image conversion in the DVP case.

    Push the limits to 720P/30fps or even 1080P and see what you get.

    Thanks for your support, I prefer 640*480 cause opencv face or tag recognition consume lots of cpu power,  640*480@30 is acceptable. I try a few more resolution and its getting worst :)

     

    [fmt:JPEG_1X8/1280x720]   %100 cpu usage limited 15 FPS, could not reach more fps,  cpu usage at single core that means not multithreaded
    [fmt:UYVY8_2X8/1280x720]  // %190 cpu usage @30 fps ,multi threaded
    [fmt:UYVY8_2X8/1980x1080] // could not handle 30fps ,%200 cpu usage at 15FPS 
     

     

    UPDATE: my best scenario is fmt:UYVY8_2X8 and opencv CV_CAP_PROP_FOURCC property is CV_FOURCC('Y', 'U', '1', '2') Cpu usage ~%52

  3. 5 minutes ago, @lex said:

    There must be no conversion in the image format to achieve this. It is interesting to find out more about it. Can you share more about your application and your setup and usb camera?

    yes,  u are right that means there is no conversion. The app is very simple;  open camera with opencv videocapturer and grap image with opencv(v3.4.10) and calculate fps (no display). Setup Pine64+ 1GB A64 Kernel 5.9.3 with HBV1318 ov5640 usb camera

     

    cpu usage is %6-8 at each core and total cpu usage %25 -31 ( 640*480*30FPS) 

     

    device listed as 

    doccamera: doccamera (usb-1c1a000.usb-1):
            /dev/video4
            /dev/video5
     

  4. Update: Analog sound + mic working

     

    I attached overlay for microphone and headphone. Tested with Pine64+ A64 Kernel 5.9.5 and working. You have to add overlay and set alsa configuration. Settings are just for template, you could modify to find best. Thank you. 

    amixer cset name='Headphone Playback Switch' on
    amixer cset name='Headphone Source Playback Route' DAC
    amixer cset name='Line In Playback Switch' off
    amixer cset name='Line Out Playback Switch' off
    amixer cset name='Line Out Source Playback Route' Mono Differential
    amixer cset name='Mic1 Playback Switch' off
    amixer cset name='Mic2 Playback Switch' off
    amixer cset name='AIF1 DA0 Playback Volume' 160
    amixer cset name='AIF1 DA0 Stereo Playback Route' Stereo
    amixer cset name='AIF2 DAC Playback Volume' 160
    amixer cset name='AIF3 ADC Source Capture Route' None
    amixer cset name='AIF2 DAC Source Playback Route' None
    amixer cset name='DAC Playback Switch' on
    amixer cset name='DAC Playback Volume' 160
    amixer cset name='ADC Digital DAC Playback Switch' off
    amixer cset name='AIF1 Slot 0 Digital DAC Playback Switch' on
    amixer cset name='AIF2 Digital DAC Playback Switch' on
    amixer cset name='DAC Reversed Playback Switch' off
    amixer cset name='Earpiece Playback Switch' off
    amixer cset name='Earpiece Source Playback Route' DACL
    
    amixer cset name='Line In Capture Switch' off
    amixer cset name='Mic1 Capture Switch' off
    amixer cset name='Mic1 Boost Volume' 0
    amixer cset name='Mic1 Playback Volume' 7
    amixer cset name='Mic2 Capture Switch' on
    amixer cset name='Mic2 Boost Volume' 0
    amixer cset name='Mic2 Playback Volume' 7
    amixer cset name='Mixer Capture Switch' off
    amixer cset name='Mixer Reversed Capture Switch' off
    amixer cset name='ADC Capture Volume' 160
    amixer cset name='ADC Gain Capture Volume' 7
    amixer cset name='AIF1 AD0 Capture Volume' 160
    amixer cset name='AIF1 Data Digital ADC Capture Switch' on
    amixer cset name='AIF2 ADC Capture Volume' 160
    amixer cset name='AIF2 ADC Mixer ADC Capture Switch' on
    amixer cset name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off
    amixer cset name='AIF2 ADC Mixer AIF2 DAC Rev Capture Switch' off
    amixer cset name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off
    amixer cset name='AIF2 ADC Mixer AIF1 DA0 Capture Switch' off

     

    you could test speaker with:

    speaker-test -twav -c2

     

    you could test microphone with;

    arecord -f S16_LE -d 5 -r 16000 -c 2 test.wav 

    aplay test.wav

    sound_overlay.dts

  5. Platform Kernel 5.9.5 Pine64+ A64 buster server

    Analog sound working ! After a few days, i figure out the analog sound problem. There is a widget property in sound definition at sun50i-a64-pine64.dts file.  This mainly specifies audio off-codec DAPM widgets (Dynamic Audio Power Management for Portable Devices according to devicetree/bindings/sound/widgets.txt) In my case this widgets disable analog sound and i couldnt find a way to enable it :) I remove widget line and linked routing properties from dts file and rebuild it and it works. If you dont want to rebuild armbian alternate way is using a custom overlay.  Dont forget to unmute HeadPhone with "m" key and increase AIF1 DA0. I hope it will help to someone.  Unfortunately i could not enable microphone input, any ideas?? Thanks

    sound_overlay.dts

  6. Thanks @guidol I am testing with pine64+ A64 kernel 5.9.5 i have same warnings in original dtb. I try many things but i could not figure whats wrong! I try to compare my dts file with yours.Do you have source, i mean dts files before compiled(easy to read) or is that https://github.com/megous/linux/tree/orange-pi-5.9  Thank you

    i try to gave more information 

     

    UPDATE:  I found a solution

     

  7. On 11/1/2020 at 5:08 PM, Hannes Worst said:

    Great, Guidol!

     

    Thank you very much for this good news. I wil try it out! Thanks for the one that solved the problem.

     

    Hi, do you have a chance to test it? I could not get sound from audio jack. Could you share your dts if the analog audio working? Thank you

  8. Armbianmonitor:

    Hi, I try to enable sound on headphone jack with pine64+ but i could not :) Alsa says "no sound found" at dmesg Could anyone help me?  Thank you

     

    root@pine64:~# dmesg|grep -i sound
    [    2.686397]   No soundcards found.
    [    6.323086] input: sun50i-a64-audio Headset Jack as /devices/platform/sound/sound/card0/input5

     

    root@pine64:~# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: sun50ia64audio [sun50i-a64-audio], device 0: 1c22c00.dai-sun8i-codec-aif1 sun8i-codec-aif1-0 [1c22c00.dai-sun8i-codec-aif1 sun8i-codec-aif1-0]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: sun50ia64hdmi [sun50i-a64-hdmi], device 0: 1c22800.i2s-i2s-hifi i2s-hifi-0 [1c22800.i2s-i2s-hifi i2s-hifi-0]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
     

    Alsamixer Settings;

    mixer_settings.thumb.jpg.e0caa38d2561439def35d96b85a5301b.jpg

  9. 3 minutes ago, @lex said:

     

    This error is: /* No such device or address */

     

    You should double-check:

     

    1. Is your sensor OV5640?

    2. Check the connector, some are reversed 180º which is the case for BPI and Orange Pi. There is a Thread about it, 3 years old a think.

    yes sensor is ov5640 and not reversed maybe there was a hardware issue, i dont know, i ordered a new one. Btw  i have a reversed one (BP camera). I double check everything but no luck. May i ask is ov5640 works without any issue with a64 (pine64) or could you advise any camera ? i need 30 fps 640x480 to process with opencv. Thank you

  10. 1 hour ago, Robert Heller said:

    A fragment of my DTS is elsewhere in this thread. Note: it is for a Banana Pi M64, which is probably different from your Pine64.  I got my working properly by refering to the schematic diagram I have for the Banana Pi M64.  You need to get the schematic diagram for your Pine64, so you know exactly which GPIO pines are wired to the CSI connector, then you can be sure that the DTS file properly sets up the correct GPIO pins to the correct functions.

    Thanks for fast reply,First I changed them according to schematic and i checked, gpios are correct, if there was an issue on my camera or not connectted, could i see device wiith "v4l2-ctl --list-devices" ? Maybe there is a problem on camera hardware. Thank you

  11. On 10/31/2020 at 7:40 PM, Robert Heller said:

     

    OK, make sure that the ov5640 module is also enabled.

    Hi, I am working more than 4 days but no luck, could you share your dts and config file. I dont understand whats wrong. i get "ov5640 1-004c: ov5640_init_slave_id: failed with -6"  error

    Thank you

     

    root@pine64:~# dmesg |grep ov5640
    [    5.692745] sun6i-csi 1cb0000.csi: creating ov5640 1-004c:0 -> sun6i-csi:0 link
    [    5.966763] ov5640 1-004c: ov5640_init_slave_id: failed with -6
    [  595.120402] ov5640 1-004c: ov5640_init_slave_id: failed with -6
     

     

    root@pine64:~# v4l2-ctl --list-devices
    cedrus (platform:cedrus):
            /dev/video0

    root@pine64:~# lsmod | grep ov
    ov5640                 32768  1
    v4l2_fwnode            28672  2 ov5640,sun6i_csi
    videodev              258048  7 sunxi_cedrus,v4l2_fwnode,ov5640,videobuf2_v4l2,sun6i_csi,videobuf2_common,v4l2_mem2mem
    mc                     57344  7 sunxi_cedrus,videodev,ov5640,videobuf2_v4l2,sun6i_csi,videobuf2_common,v4l2_mem2mem
     

  12. I try to enable CSI Camera for pine64 A64+ Mainline Kernel (5.8x) config "CONFIG_VIDEO_SUN6I_CSI=m" NOT located in the kernel config file. And I try to add this line to /build/userpatches/linux-sunxi64-current.config and  recompile. Unfortunately my compiled konfig file doesnt contain CONFIG_VIDEO_SUN6I_CSI, i try to find it in  KKonfig menu but i coult not locate in the menu. Could anyone help? thank you.

  13. 1 hour ago, Tido said:

     ArmbianIO API - in C
    https://forum.armbian.com/topic/5655-armbianio-api-proposal/


     pyGPIO - A 'more general' python GPIO library based on pyA20
    https://forum.armbian.com/topic/5662-pygpio-a-more-general-python-gpio-library

     

    Thanks for your answer, i checked ArmbianIO, it is based on sysfs.

    pyGPIO is based on dev/mem, this is what i am looking unfortunatelly it does not support interrupts. I could not find a way to get gpio int from memory.

    thank you.

  14. On 11/2/2018 at 8:43 AM, martinayotte said:

    The simplest way is to use gpio sysfs ...

    
    echo 20 > /sys/class/gpio/export
    echo out > /sys/class/gpio/gpio20/direction
    echo 1 > /sys/class/gpio/gpio20/value

     

    Hi,I am a developing a c++ application with OPI 0+2 (h5 + mainline kernel), controls a motor with an encoder and a driver. I did it , but it consume to much cpu power (%8) . I could access with using sysfs and character device. Both of them works like open->read->close .Actually it works very well with polling. Unfortunately consume to much cpu. Interrupt freq around 6600hz (150 us) . Is there anyway to control interrupt with dev mem? Or could anyone give me a startup point to access (c++) gpio interrupts efficiently. Btw i tyied libgpiod based on character device. Thank you.

  15. Bluetooth init success :) with Orange pi zero plus 2 Mainline kernel 5.4.28

    i solve problem with these steps:

    1) install bluetooth support from armbian-config

    2) install devmem2 and compile if not installed 

    wget http://free-electrons.com/pub/mirror/devmem2.c
    gcc ./devmem2.c
    mv ./a.out /usr/local/bin/devmem2

    3) add modules bluetooth and hci_uart to /etc/modules

    4) remove bluetooth service (we will add new script)

    update-rc.d bluetooth remove

    5) remove blutooth init script (editing not worked for me)

    rm /etc/init.d/bluetooth

    6) copy modified  bluetooth init script file(ap6212) to /etc/init.d/

    7) edit permissions 

    chmod +x /etc/init.d/ap6212

    8) enable service script 

    systemctl enable ap6212

    9) reboot

     

    after reboot probably you will see your service succefully running 

    systemctl status ap6212

     

    ● ap6212.service - LSB: Start bluetooth daemons
       Loaded: loaded (/etc/init.d/ap6212; generated)
       Active: active (running) since Tue 2020-04-28 23:31:54 UTC; 38s ago
         Docs: man:systemd-sysv-generator(8)
      Process: 735 ExecStart=/etc/init.d/ap6212 start (code=exited, status=0/SUCCESS)
        Tasks: 1 (limit: 371)
       Memory: 4.2M
       CGroup: /system.slice/ap6212.service
               └─1071 /usr/sbin/bluetoothd

    Apr 28 23:31:51 orangepizeroplus2-h5 systemd[1]: Starting LSB: Start bluetooth daemons...
    Apr 28 23:31:54 orangepizeroplus2-h5 ap6212[735]: Starting Patch ap6212:/dev/mem opened.
    Apr 28 23:31:54 orangepizeroplus2-h5 ap6212[735]: Memory mapped at address 0xffff87107000.
    Apr 28 23:31:54 orangepizeroplus2-h5 ap6212[735]: Value at address 0x1F00060 (0xffff87107060): 0x0
    Apr 28 23:31:54 orangepizeroplus2-h5 ap6212[735]: Written 0x1; readback 0x1
    Apr 28 23:31:54 orangepizeroplus2-h5 ap6212[735]: Starting ap6212: bluetoothd.
    Apr 28 23:31:54 orangepizeroplus2-h5 systemd[1]: Started LSB: Start bluetooth daemons.
    Apr 28 23:31:54 orangepizeroplus2-h5 bluetoothd[1071]: Bluetooth daemon 5.50
    Apr 28 23:31:54 orangepizeroplus2-h5 bluetoothd[1071]: Starting SDP server
    Apr 28 23:31:54 orangepizeroplus2-h5 bluetoothd[1071]: Bluetooth management interface 1.14 initialized

     

    Q: what is difference between ap6212 and bluetooth service init?

    A:  added gpio  controls

     

    Now you can attach uart with sucess

     

    hciattach /dev/ttyS1 any 115200 flow bdaddr 00:90:4c:c5:12:38
    hciconfig hci0 up

     

    i could not change mac adress device always setup with AA:AA:AA:AA:AA:AA 

    if you can please let me know.

    Thanks 

     

    Save as ap6212 and copy to /etc/init.d/

    #! /bin/sh
    ### BEGIN INIT INFO
    # Provides: ap6212
    # Required-Start:    $local_fs $syslog $remote_fs dbus
    # Required-Stop:     $local_fs $syslog $remote_fs
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Start bluetooth daemons
    ### END INIT INFO
    #
    # bluez    Bluetooth subsystem starting and stopping
    #
    # originally from bluez's scripts/bluetooth.init
    #
    # Edd Dumbill <ejad@debian.org>
    # LSB 3.0 compilance and enhancements by Filippo Giunchedi <filippo@debian.org>
    #
    # Updated for bluez 4.7 by Mario Limonciello <mario_limonciello@dell.com>
    # Updated for bluez 5.5 by Nobuhiro Iwamatsu <iwamatsu@debian.org>
    #
    # Note: older daemons like dund pand hidd are now shipped inside the
    # bluez-compat package
    
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    DESC=ap6212
    
    DAEMON=/usr/sbin/bluetoothd
    HCIATTACH=/usr/bin/hciattach
    
    HID2HCI_ENABLED=1
    HID2HCI_UNDO=1
    
    SDPTOOL=/usr/bin/sdptool
    
    # If you want to be ignore error of "org.freedesktop.hostname1",
    # please enable NOPLUGIN_OPTION.
    # NOPLUGIN_OPTION="--noplugin=hostname"
    NOPLUGIN_OPTION=""
    SSD_OPTIONS="--oknodo --quiet --exec $DAEMON -- $NOPLUGIN_OPTION"
    
    test -f $DAEMON || exit 0
    
    # FIXME: any of the sourced files may fail if/with syntax errors
    test -f /etc/default/bluetooth && . /etc/default/bluetooth
    test -f /etc/default/rcS && . /etc/default/rcS
    
    . /lib/lsb/init-functions
    
    set -e
    
    # FIXME: this function is possibly a no-op
    run_sdptool()
    {
    	# declaring IFS local in this function, removes the need to
    	# save/restore it
    	local IFS o
    
    	test -x $SDPTOOL || return 1
    
    # FIXME: where does SDPTOOL_OPTIONS come from?
    	if ! test -z "$SDPTOOL_OPTIONS" ; then
    		IFS=";"
    		for o in $SDPTOOL_OPTIONS ; do
    			#echo "execing $SDPTOOL $o"
    			IFS=" "
    			if [ "$VERBOSE" != no ]; then
    				$SDPTOOL $o
    			else
    				$SDPTOOL $o >/dev/null 2>&1
    			fi
    		done
    	fi
    }
    
    hci_input()
    {
        log_progress_msg "switching to HID/HCI no longer done in init script, see /usr/share/doc/bluez/NEWS.Debian.gz" || :
    }
    
    
    fixstart()
    {
      log_daemon_msg "Starting Patch $DESC"
      /usr/local/bin/devmem2 0x1f00060 b 1
      echo 10 > /sys/class/gpio/export
      echo out > /sys/class/gpio/gpio10/direction
      echo 0 > /sys/class/gpio/gpio10/value
      echo 1 > /sys/class/gpio/gpio10/value
      sleep 0.1
    }
    
    fixstop()
    {
    	# disable gpio pin, if not wifi not active on soft restart / reboot
      log_daemon_msg "Disable Patch $DESC" 
    
      /usr/local/bin/devmem2 0x1f00060 b 0
      echo 10 > /sys/class/gpio/export
      echo out > /sys/class/gpio/gpio10/direction
      echo 0 > /sys/class/gpio/gpio10/value
      sleep 0.1
      echo 10 > /sys/class/gpio/unexport
      sleep 0.1
    }
    
    alias enable_hci_input=hci_input
    alias disable_hci_input=hci_input
    alias enable_fix=fixstart
    alias disable_fix=fixstop
    
    case $1 in
      start)
      	enable_fix
    	
    	log_daemon_msg "Starting $DESC"
    
    	if test "$BLUETOOTH_ENABLED" = 0; then
    		log_progress_msg "disabled. see /etc/default/bluetooth"
    		log_end_msg 0
    		exit 0
    	fi   
    
    	start-stop-daemon --start --background $SSD_OPTIONS
    	log_progress_msg "${DAEMON##*/}"
    
    	run_sdptool || :
    
    	if test "$HID2HCI_ENABLED" = 1; then
    		enable_hci_input
    	fi
    
    	log_end_msg 0
      ;;
      stop)
      	disable_fix
              
    	log_daemon_msg "Stopping $DESC"
    	if test "$BLUETOOTH_ENABLED" = 0; then
    		log_progress_msg "disabled."
    		log_end_msg 0
    		exit 0
    	fi
    	if test "$HID2HCI_UNDO" = 1; then
    		disable_hci_input
    	fi
    	start-stop-daemon --stop $SSD_OPTIONS
    	log_progress_msg "${DAEMON}"
    	log_end_msg 0
      ;;
      restart|force-reload)
    	$0 stop
    	sleep 1
    	$0 start
      ;;
      status)
    	status_of_proc "$DAEMON" "$DESC" && exit 0 || exit $?
      ;;
      *)
    	N=/etc/init.d/ap6212
    	echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
    	exit 1
    	;;
    esac
    
    exit 0
    
    # vim:noet
    


     

  16. On 3/2/2020 at 10:49 PM, Spider said:

    :)

    Thx, for reply. But I finaly launch BT device.

    Next steps:

    1. Disable uart1 overlay

    2. copyed firmware for ap6212 from last broadcom package into /lib/firmware/bcm....

    3. modified ap6212-bluetooth

          - at start add:

     

    
            devmem2 0x1f00060 b 1
            echo 10 > /sys/class/gpio/export
            echo out > /sys/class/gpio/gpio10/direction
            echo 0 > /sys/class/gpio/gpio10/value
            echo 1 > /sys/class/gpio/gpio10/value
            sleep 0.1
    
    

     

          - at end add: (else after soft reboot wifi will not work)

     

    
            devmem2 0x1f00060 b 0
            echo 10 > /sys/class/gpio/export
            echo out > /sys/class/gpio/gpio10/direction
            echo 0 > /sys/class/gpio/gpio10/value
    
            sleep 0.1
    
            echo 10 > /sys/class/gpio/unexport
            sleep 0.1
    
    

     

     

    Hi , i have a same problem with opiz+2  Mainline kernel 5.4.2x  i  could not find ap6212-bluetooth file (i did it before on legacy kernel), now i have only bluetooth file. I try to edit this file but nothing change. Could you a bit clear how to success with bluetooth.  Thanks 

×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines