Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sensor jxf23 not initialized in Xiaofang 1S #11

Open
mikolaj-kow opened this issue Jan 6, 2019 · 16 comments
Open

sensor jxf23 not initialized in Xiaofang 1S #11

mikolaj-kow opened this issue Jan 6, 2019 · 16 comments

Comments

@mikolaj-kow
Copy link

mikolaj-kow commented Jan 6, 2019

Hi,

i have Xiaofang 1S, 64M model. It worked well with cfw. With this rootfs sensor can not be used.

Some debug and my configuration:

[root@DafangHacks:init.d]# echo 1 >/proc/jz/sinfo/info
[root@DafangHacks:init.d]# cat /proc/jz/sinfo/info
sensor not found

[root@DafangHacks:init.d]# lsmod
sensor_jxf23 9120 1 - Live 0xc0605000 (O)
tx_isp 357073 0 - Live 0xc0596000 (O)
sinfo 7814 0 - Live 0xc0527000 (O)
sample_motor 11647 0 - Live 0xc051c000 (O)
rtl8189fs 1594052 0 - Live 0xc028f000

[root@DafangHacks:init.d]# cat /proc/cmdline 
console=ttyS1,115200n8 mem=41700K@0x0 ispmem=8M@0x28B9000 rmem=15644K@0x30B9000 init=/linuxrc root=/dev/mmcblk0p1 rootwait rootfstype=ext3 rw mtdparts=jz_sfc:256k(boot),2048k(kernel),3392k(root),640k(driver),4736k(appfs),2048k(backupk),640k(backupd),2048k(backupa),256k(config),256k(para),-(flag)

[root@DafangHacks:init.d]# free -m
             total       used       free     shared    buffers     cached
Mem:            34         31          3          0          5         15
-/+ buffers/cache:         10         24
Swap:            0          0          0

I've also found this in dmesg

[   23.938817] probe ok ------->jxf23
[   24.089668] -----jxf23_detect: 434 ret = 0, v = 0x0f
[   24.090085] -----jxf23_detect: 442 ret = 0, v = 0x23
[   24.090099] jxf23 0-0040: jxf23 chip found @ 0x40 (i2c0)
[   24.095605] tx_isp: Registered sensor subdevice jxf23 0-0040
[   24.101577] CPU 0 Unable to handle kernel paging request at virtual address 00000044, epc == c05a485c, ra == c05a4858
[   24.112634] Oops[#1]:
[   24.114996] CPU: 0 PID: 215 Comm: v4l2rtspserver- Tainted: G           O 3.10.14 #77
[   24.123025] task: 81b39440 ti: 811ce000 task.ti: 811ce000
[   24.128618] $ 0   : 00000000 7fab0fb4 00000000 815f0224
[   24.134047] $ 4   : 80c5931c 816af7a0 00000000 8028c444
[   24.139482] $ 8   : 00000000 80c5931c 00000000 00000000
[   24.144915] $12   : 00000000 00000001 00000000 00000000
[   24.150347] $16   : 80c59204 80c59200 815f0224 800c56c0
[   24.155775] $20   : 00000010 00000000 00000000 00000000
[   24.161205] $24   : 00000000 7762ac50                  
[   24.166637] $28   : 811ce000 811cfbf0 00000000 c05a4858
[   24.172067] Hi    : 00000000
[   24.175049] Lo    : 0000030c
[   24.178149] epc   : c05a485c isp_core_ops_ioctl+0x128/0xf48 [tx_isp]
[   24.184733]     Tainted: G           O
[   24.188717] ra    : c05a4858 isp_core_ops_ioctl+0x124/0xf48 [tx_isp]
[   24.195299] Status: 10001c03 KERNEL EXL IE 
[   24.199645] Cause : 40808008
[   24.202625] BadVA : 00000044
[   24.205609] PrId  : 00d00101 (Ingenic Xburst)
[   24.210121] Modules linked in: sensor_jxf23(O) tx_isp(O) sinfo(O) sample_motor(O) rtl8189fs
[   24.218809] Process v4l2rtspserver- (pid: 215, threadinfo=811ce000, task=81b39440, tls=77be0460)
[   24.227913] Stack : 00000006 8003b9a0 10001c03 00000000 000001ad 00000001 40809000 801ec360
[   24.227913]    10001c01 80522eaa 00000000 811cfc88 00000000 815f0224 800c56c0 00000010
[   24.227913]    00000000 c059bd54 00000000 00000000 00000000 00000000 00000000 00000001
[   24.227913]    816af75c 80761000 811cfd78 811cfd78 814b4b00 816af600 815f0000 811cfd78
[   24.227913]    00000000 c05976e4 00000000 803b5834 811cfd78 814b4b00 816af75c 815f0000
[   24.227913]    ...
[   24.264854] Call Trace:
[   24.267487] [<c05a485c>] isp_core_ops_ioctl+0x128/0xf48 [tx_isp]
[   24.273906] [<c059bd54>] tx_isp_v4l2_dev_notify+0xa8/0x1d0 [tx_isp]
[   24.280590] [<c05976e4>] subdev_core_ops_set_input+0x230/0x348 [tx_isp]
[   24.287631] [<c0597a68>] video_in_core_ops_ioctl+0x1a0/0x6fc [tx_isp]
[   24.294405] [<8028cbf4>] subdev_do_ioctl+0x7b0/0x7d8
[   24.299557] [<80284f10>] video_usercopy+0x2c0/0x430
[   24.304616] [<8028c438>] subdev_ioctl+0x14/0x20
[   24.309313] [<8027eabc>] v4l2_ioctl+0x94/0x164
[   24.313926] [<800e7e3c>] vfs_ioctl+0x2c/0x4c
[   24.318346] 
[   24.319885] 
[   24.319885] Code: 0040f809  24060044  8e020104 <94430044> 3c02c05d  1000036c  a443777a  3c02801f  00002821 
[   24.330661] ---[ end trace 76ead447877c6302 ]---

Is this a problem with memory allocation?

@fabicodes
Copy link

The problem seems to be with the driver, I've just got video working on my Xiaofang S1 with this rootfs. I'm going to create a pull request soon

@fabicodes
Copy link

Sorry, took me a while to continue on this. Could you please try my rootfs fork?
https://github.com/fabi280/rootfs

@mikolaj-kow
Copy link
Author

mikolaj-kow commented Jan 12, 2019

Thanks, with your rootfs sensor is working.

[root@DafangHacks:~]# lsmod
sample_motor 11647 0 - Live 0xc064d000 (O)
sensor_jxf23 9883 1 - Live 0xc0640000 (O)
tx_isp 363556 3 - Live 0xc05cf000 (O)
sinfo 9712 0 - Live 0xc055d000 (O)
rtl8189fs 1594052 0 - Live 0xc02d0000
exfat 106736 0 - Live 0xc007f000 (O)
[root@DafangHacks:~]# echo 1 >/proc/jz/sinfo/info
[root@DafangHacks:~]# cat /proc/jz/sinfo/info
sensor :jxf23

However, the h264 stream 720p@15fps is freezing after 5~60 seconds with the default memory map mem=32M@0x0 ispmem=8M@0x2000000 rmem=24M@0x2800000.

Also audio is not available

2019-01-12 23:43:40.797 ( 163.737s) [DeviceSource    ]        ALSACapture.cpp:695    ERR| Audio Get Frame Data error
2019-01-12 23:43:40.798 ( 163.738s) [DeviceSource    ]        ALSACapture.cpp:690    ERR| Audio Polling Frame Data error

Typo in detection script
/usr/userscripts/detectionOff.sh: line 15: /usr/bin/mosquitto_pub.bin: not found

@dsbaars
Copy link

dsbaars commented Mar 3, 2019

I tried it as well, same problem. Freezes and reboots. Also tried with lowest resolution 640x360@10fps and CBR.
No improvement with memory map mem=41700K@0x0 ispmem=8M@0x28B9000 rmem=15644K@0x30B9000

@n1zzo
Copy link

n1zzo commented Mar 9, 2019

Same here,
is there anything that I can try to fix this issue?

@n1zzo
Copy link

n1zzo commented Mar 9, 2019

Fixed, the rtsp server was spinning to 98% CPU usage because of the audio error,
the solution is to use ALSA as a sound provider, which can be set by adding a -a to the /usr/controlscripts/rtsp-h264 file as in:

   if [ "$AUDIOFORMAT" != "OFF" ] ; then
        AUDIOPARAM="-a -E $AUDIOFORMAT:$AUDIOINBR:$AUDIOOUTBR"
        setconf -k h -v "$HWVOLUME" 2>/dev/null

@fabi280, please add it to the forked rootfs.

fabicodes added a commit to fabicodes/rootfs that referenced this issue Mar 9, 2019
@fabicodes
Copy link

Thank you. I've added it but didn't check the fix yet :)

@dsbaars
Copy link

dsbaars commented Mar 9, 2019

I tried it, but didn't solve it for me unfortunately :( I already disabled audio to try if that would make a difference, but that didn't as well.

@n1zzo
Copy link

n1zzo commented Mar 9, 2019

Sorry to hear that @dsbaars, if you can open top and look at the CPU usage,
maybe there is some other process consuming too much resources.
Is there a way to check temperature sensors?
I have 5 minutes uptime now, I'll continue to investigate eventual freezes.

@n1zzo
Copy link

n1zzo commented Mar 9, 2019

I've compared 1280x720 h264rstp vs 1920x1080,
they consume respectively 30% of CPU and 40% so this seems not to be a big issue.

@dsbaars
Copy link

dsbaars commented Mar 9, 2019

I actually removed everything from autoboot, including lighttpd and using 640x360.
After manually starting using /usr/controlscripts/rtsp-h264, even without viewing the stream the load increases rapidly from 0.83 to 1.69 and then freezes.

These are the only processes running just before the freeze:

[root@DafangHacks:~]# ps ax
PID   USER     TIME  COMMAND
    1 root      0:01 {linuxrc} init
    2 root      0:00 [kthreadd]
    3 root      0:00 [ksoftirqd/0]
    4 root      0:00 [kworker/0:0]
    5 root      0:00 [kworker/0:0H]
    6 root      0:00 [kworker/u2:0]
    7 root      0:00 [rcu_preempt]
    8 root      0:00 [rcu_bh]
    9 root      0:00 [rcu_sched]
   10 root      0:00 [watchdog/0]
   11 root      0:00 [khelper]
   12 root      0:00 [writeback]
   13 root      0:00 [bioset]
   14 root      0:00 [kblockd]
   15 root      0:00 [khubd]
   17 root      0:00 [cfg80211]
   18 root      0:00 [kworker/0:2]
   19 root      0:00 [kswapd0]
   20 root      0:00 [fsnotify_mark]
   21 root      0:00 [crypto]
   36 root      0:00 [i2s_work_1]
   37 root      0:00 [i2s_codec_irq_w]
   38 root      0:00 [deferwq]
   39 root      0:00 [mmcqd/0]
   40 root      0:00 [kworker/u2:2]
   41 root      0:00 [kworker/0:1H]
   42 root      0:00 [jbd2/mmcblk0p1-]
   43 root      0:00 [ext4-dio-unwrit]
   53 root      0:00 [jffs2_gcd_mtd9]
   84 root      0:19 [ksdioirqd/mmc1]
   92 root      0:00 [irq/37-isp]
  110 root      0:00 [RTW_XMIT_THREAD]
  111 root      0:08 [RTW_CMD_THREAD]
  112 root      0:00 [RTWHALXT]
  113 root      0:00 [RTWHALXT]
  122 root      0:00 wpa_supplicant -d -B -i wlan0 -c /etc/wpa_supplicant.conf -P /var/run/wpa_supplicant.pid
  152 root      0:00 udhcpc -i wlan0 -p /var/run/udhcpc.pid -s /etc/udhcpc.script -b -x hostname:DafangHacks
  155 root      0:00 busybox ntpd -p time.google.com
  160 root      0:00 dropbearmulti dropbear -R
  162 root      0:00 /sbin/getty -l /bin/autologin -L console 115200 vt100
  167 root      0:00 dropbearmulti dropbear -R
  168 root      0:00 -sh
  198 root      0:18 v4l2rtspserver-master -W640 -H360 -a -E MP3:16000:44100 -r 1 -P 8554
  202 root      0:02 [apical_isp_fw_p]
  246 root      0:00 ps ax

@n1zzo
Copy link

n1zzo commented Mar 9, 2019

I see that you have the Mp3 encoding active, that should take some resources.
Can we see which resource makes the device freeze? If it is RAM depletion or thermal protection.
Or maybe it is a kernel panic, attaching a UART to the device could solve this doubt.

@n1zzo
Copy link

n1zzo commented Mar 9, 2019

Could this be related?
samtap/fang-hacks#61
I got 7.30 hours of uptime without freezes during the night, so probably it's a thermal related issue.
Camera had IR led turned on and IR cut turned off.
Also on FHD the RTSP server gets killed by the kernel every ~2minutes, on 1280x720 it does not.
The audio is set on PCM:16000:44100.

@x86dev
Copy link

x86dev commented Mar 15, 2019

The at the moment compiled binary of v4l2rtspserver-master has hardcoded paths in it, which are not present (anymore) on the rootfs image See: #4.

For me symlinking the new locations to the old locations (where the current v4l2rtspserver-master expects the files) is fixing a lot a problems:

mkdir -p /system/sdcard/scripts
ln /usr/scripts/detectionTracking.sh /system/sdcard/scripts/detectionTracking.sh
ln /usr/scripts/detectionOff.sh /system/sdcard/scripts/detectionOff.sh
ln /usr/scripts/detectionOn.sh /system/sdcard/scripts/detectionOn.sh

Works as a temporary solution.

@x86dev
Copy link

x86dev commented Mar 15, 2019

... and one more for the night mode script:

ln /usr/scripts/nightmode.sh /system/sdcard/scripts/nightmode.sh

@quantum8
Copy link

I've tried the original rootfs, but couldn't get the image sensor working so I thought I'd give the forked rootfs a go. I still can't get it working though! I've cloned the forked rootfs into an ext3 formatted card, renamed the 64mb uEnv file, and entered my wifi details in WPA_Supplicant and it doesn't get past the step where it loads v4l2rtspserver-master. I get the page fault error:

DafangHacks login: [ 5.857088] do_page_fault() #2: sending SIGSEGV to v4l2rtspserver- for invalid read access from
[ 5.857088] 00000000 (epc == 77499f18, ra == 00452eec)

Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants