In my Debian rootfs I was getting DNS temporary failure when I was doing a apt update. This link fixes the problem ---> https://unix.stackexchange.com/questions/321491/android-chroot-networking-issues
The Soul of a Machine
Sunday 19 May 2019
Monday 11 March 2019
LCD Parallel Interface parameter calculations
In this post I would like to describe the different LCD parameters and their calculations.
First we understand the LCD display parameters with the following diagram.
In the diagram we have the following terms:
H-Sync: A horizontal synchronize pulse used to synchronize/signal the start of a scan line. Here a scan line means one row/line (of pixels) in the LCD. The signal can be low or a high pulse of a certain duration determined by the setup time (Thsys) and hold time (Thsyh) of this pulse. It is usually mentioned in nano seconds which can also be converted to dotclks which I will come to later.
V-Sync: A veritical synchronize pulse used to synchronize/signal the start of each frame. Here the frame is inclusive of all the vertical and horizontal porches and the H-Sync pulse. The signal can be a low or a high pulse of a certain duration determined by the setup (Tvsys) and hold time (Tvsyh) of this pulse.
HBP and HFP: Horizontal back and front porches. It is used to "eat away" a certain set of pixel clocks before the active line starts and ends. The porch which is before the active line starts is called the back porch and the porch which is after the active line ends is called the front porch. Linux term is left_margin and right_margin for HBP and HFP respectively.
VBP and VFP: Vertical back and from porches. It is used to "eat away" a certain set of lines before after the actual frame starts and ends. Again the porch which is before the active frame is called the back porch and the porch which is after the active frame ends is called the front porch. Linux term is upper_margin and lower_margin for VBP and VFP respectively.
To illustrate the above concepts I will put some of the figures from datasheets
The below example shows the HSYNC in relation to the active pixels, HBP, HFP and also the DOTCLK.
In the diagram above you can see the HSYNC low pulse. The pixel data will keep sending dummy data till the back porch ends with the continuously ticking DOTCLK providing the timing for the HSYNC, HBP, actual pixel data and the HFP. The HBP and HFP period should be a multiple of the DOTCLK period.
Another timing diagram is from the S3C2440 data sheet.
Here we can see the interrupt for the frame sync i.e. VSYNC which is INT_FrSync. This interrupt is useful for the double buffering technique where we can load the image onto an inactive frame buffer between the VSYNCs. When we get the interrupt from the VSYNC we can just change the pointer from the active framebuffer to the back buffer which becomes the active framebuffer. We can start loading the previous framebuffer which becomes inactive.
As seen in the figure the VSYNC and the HSYNC rising edge of the pulse for the start of the frame coincide. In this case the VSYNC and the HSYNC are high pulses. In the figure the VSYNC pulse width is equal to a HSYNC clock period. The polarity of the SYNC pulses can be controlled in the LCDCON5 register. The DOTCLK polarity too can be controlled. As per the figure we can get the follow formula for the Horizontal line time period:
Also for the time for a single frame can be calculated as:
I will explain why porches are needed in the coming sections.
First we understand the LCD display parameters with the following diagram.
In the diagram we have the following terms:
H-Sync: A horizontal synchronize pulse used to synchronize/signal the start of a scan line. Here a scan line means one row/line (of pixels) in the LCD. The signal can be low or a high pulse of a certain duration determined by the setup time (Thsys) and hold time (Thsyh) of this pulse. It is usually mentioned in nano seconds which can also be converted to dotclks which I will come to later.
V-Sync: A veritical synchronize pulse used to synchronize/signal the start of each frame. Here the frame is inclusive of all the vertical and horizontal porches and the H-Sync pulse. The signal can be a low or a high pulse of a certain duration determined by the setup (Tvsys) and hold time (Tvsyh) of this pulse.
HBP and HFP: Horizontal back and front porches. It is used to "eat away" a certain set of pixel clocks before the active line starts and ends. The porch which is before the active line starts is called the back porch and the porch which is after the active line ends is called the front porch. Linux term is left_margin and right_margin for HBP and HFP respectively.
VBP and VFP: Vertical back and from porches. It is used to "eat away" a certain set of lines before after the actual frame starts and ends. Again the porch which is before the active frame is called the back porch and the porch which is after the active frame ends is called the front porch. Linux term is upper_margin and lower_margin for VBP and VFP respectively.
To illustrate the above concepts I will put some of the figures from datasheets
The below example shows the HSYNC in relation to the active pixels, HBP, HFP and also the DOTCLK.
In the diagram above you can see the HSYNC low pulse. The pixel data will keep sending dummy data till the back porch ends with the continuously ticking DOTCLK providing the timing for the HSYNC, HBP, actual pixel data and the HFP. The HBP and HFP period should be a multiple of the DOTCLK period.
Another timing diagram is from the S3C2440 data sheet.
Here we can see the interrupt for the frame sync i.e. VSYNC which is INT_FrSync. This interrupt is useful for the double buffering technique where we can load the image onto an inactive frame buffer between the VSYNCs. When we get the interrupt from the VSYNC we can just change the pointer from the active framebuffer to the back buffer which becomes the active framebuffer. We can start loading the previous framebuffer which becomes inactive.
As seen in the figure the VSYNC and the HSYNC rising edge of the pulse for the start of the frame coincide. In this case the VSYNC and the HSYNC are high pulses. In the figure the VSYNC pulse width is equal to a HSYNC clock period. The polarity of the SYNC pulses can be controlled in the LCDCON5 register. The DOTCLK polarity too can be controlled. As per the figure we can get the follow formula for the Horizontal line time period:
One horizontal line time period = HSYNC width + Horizontal Back porch width + Horizontal data time + Horizontal Front porch width
Also for the time for a single frame can be calculated as:
One frame time period = Vertical Sync pulse width + Vertical back porch + Complete frame time + Vertical back porch
I will explain why porches are needed in the coming sections.
Monday 4 February 2019
Android Nougat 7.1.1 boot up on Beaglebone Black
Finally got Android Nougat 7.1.1 boot up on my Beaglebone black. I am not sure whether it is a fluke or for real as I have to replicate it again with a rebuild.
I had removed all the different PRODUCT_PROPERTY_OVERRIDES because of one service complaining about another service not being present. One last thing I removed was config.disable_noncore=true. Now I re-enabled the same and built the whole thing up. I will update the results soon.
*Update*: Tried adding config.disable_noncore and it starts crashing. Did a make clean and rebuilt by removing config.disable_noncore and it started working.
Also I bought a new set of microSD cards which are class 10 and is much faster than the previous crappy microSD cards. Let me see if they made a difference.
*Update*: Yes they make a difference. They are faster to write and it is faster for the overall system too.
There is still a crash which I saw in the first boot which is IpManager.eth0 which was plaguing before. Leaving the system just like that manages to start the system even though there is a single set of kills of audioserver, cameraserver, media, netd but it recovers. This problem I think I will have to try fixing it. Doing a simple cursory search shows a Linaro chat log saying it is some subtle timing bug introduced by the printing but I am not very sure about this.
A 'service list' commands gives the following services:
In the mean time a screenshot to celebrate.
I had removed all the different PRODUCT_PROPERTY_OVERRIDES because of one service complaining about another service not being present. One last thing I removed was config.disable_noncore=true. Now I re-enabled the same and built the whole thing up. I will update the results soon.
*Update*: Tried adding config.disable_noncore and it starts crashing. Did a make clean and rebuilt by removing config.disable_noncore and it started working.
Also I bought a new set of microSD cards which are class 10 and is much faster than the previous crappy microSD cards. Let me see if they made a difference.
*Update*: Yes they make a difference. They are faster to write and it is faster for the overall system too.
There is still a crash which I saw in the first boot which is IpManager.eth0 which was plaguing before. Leaving the system just like that manages to start the system even though there is a single set of kills of audioserver, cameraserver, media, netd but it recovers. This problem I think I will have to try fixing it. Doing a simple cursory search shows a Linaro chat log saying it is some subtle timing bug introduced by the printing but I am not very sure about this.
A 'service list' commands gives the following services:
beagleboneblack:/ # service list Found 112 services: 0 carrier_config: [com.android.internal.telephony.ICarrierConfigLoader] 1 phone: [com.android.internal.telephony.ITelephony] 2 isms: [com.android.internal.telephony.ISms] 3 iphonesubinfo: [com.android.internal.telephony.IPhoneSubInfo] 4 simphonebook: [com.android.internal.telephony.IIccPhoneBook] 5 telecom: [com.android.internal.telecom.ITelecomService] 6 isub: [com.android.internal.telephony.ISub] 7 contexthub_service: [android.hardware.location.IContextHubService] 8 dns_listener: [android.net.metrics.IDnsEventListener] 9 connmetrics: [android.net.IIpConnectivityMetrics] 10 connectivity_metrics_logger: [android.net.IConnectivityMetricsLogger] 11 imms: [com.android.internal.telephony.IMms] 12 media_projection: [android.media.projection.IMediaProjectionManager] 13 launcherapps: [android.content.pm.ILauncherApps] 14 shortcut: [android.content.pm.IShortcutService] 15 trust: [android.app.trust.ITrustManager] 16 media_router: [android.media.IMediaRouterService] 17 media_session: [android.media.session.ISessionManager] 18 restrictions: [android.content.IRestrictionsManager] 19 graphicsstats: [android.view.IGraphicsStats] 20 assetatlas: [android.view.IAssetAtlas] 21 dreams: [android.service.dreams.IDreamManager] 22 commontime_management: [] 23 network_time_update_service: [] 24 samplingprofiler: [] 25 diskstats: [] 26 appwidget: [com.android.internal.appwidget.IAppWidgetService] 27 soundtrigger: [com.android.internal.app.ISoundTriggerService] 28 jobscheduler: [android.app.job.IJobScheduler] 29 hardware_properties: [android.os.IHardwarePropertiesManager] 30 serial: [android.hardware.ISerialManager] 31 usb: [android.hardware.usb.IUsbManager] 32 DockObserver: [] 33 audio: [android.media.IAudioService] 34 wallpaper: [android.app.IWallpaperManager] 35 dropbox: [com.android.internal.os.IDropBoxManagerService] 36 search: [android.app.ISearchManager] 37 country_detector: [android.location.ICountryDetector] 38 location: [android.location.ILocationManager] 39 devicestoragemonitor: [] 40 notification: [android.app.INotificationManager] 41 recovery: [android.os.IRecoverySystem] 42 updatelock: [android.os.IUpdateLock] 43 servicediscovery: [android.net.nsd.INsdManager] 44 connectivity: [android.net.IConnectivityManager] 45 ethernet: [android.net.IEthernetManager] 46 rttmanager: [android.net.wifi.IRttManager] 47 wifiscanner: [android.net.wifi.IWifiScanner] 48 wifi: [android.net.wifi.IWifiManager] 49 wifip2p: [android.net.wifi.p2p.IWifiP2pManager] 50 netpolicy: [android.net.INetworkPolicyManager] 51 netstats: [android.net.INetworkStatsService] 52 network_score: [android.net.INetworkScoreService] 53 textservices: [com.android.internal.textservice.ITextServicesManager] 54 network_management: [android.os.INetworkManagementService] 55 clipboard: [android.content.IClipboard] 56 statusbar: [com.android.internal.statusbar.IStatusBarService] 57 device_policy: [android.app.admin.IDevicePolicyManager] 58 deviceidle: [android.os.IDeviceIdleController] 59 lock_settings: [com.android.internal.widget.ILockSettings] 60 uimode: [android.app.IUiModeManager] 61 mount: [IMountService] 62 accessibility: [android.view.accessibility.IAccessibilityManager] 63 input_method: [com.android.internal.view.IInputMethodManager] 64 pinner: [] 65 vrmanager: [android.service.vr.IVrManager] 66 input: [android.hardware.input.IInputManager] 67 window: [android.view.IWindowManager] 68 alarm: [android.app.IAlarmManager] 69 consumer_ir: [android.hardware.IConsumerIrService] 70 vibrator: [android.os.IVibratorService] 71 content: [android.content.IContentService] 72 account: [android.accounts.IAccountManager] 73 media.camera.proxy: [android.hardware.ICameraServiceProxy] 74 telephony.registry: [com.android.internal.telephony.ITelephonyRegistry] 75 scheduling_policy: [android.os.ISchedulingPolicyService] 76 webviewupdate: [android.webkit.IWebViewUpdateService] 77 usagestats: [android.app.usage.IUsageStatsManager] 78 battery: [] 79 sensorservice: [android.gui.SensorServer] 80 processinfo: [android.os.IProcessInfoService] 81 permission: [android.os.IPermissionController] 82 cpuinfo: [] 83 dbinfo: [] 84 gfxinfo: [] 85 meminfo: [] 86 procstats: [com.android.internal.app.procstats.IProcessStats] 87 activity: [android.app.IActivityManager] 88 user: [android.os.IUserManager] 89 otadexopt: [android.content.pm.IOtaDexopt] 90 package: [android.content.pm.IPackageManager] 91 display: [android.hardware.display.IDisplayManager] 92 power: [android.os.IPowerManager] 93 appops: [com.android.internal.app.IAppOpsService] 94 batterystats: [com.android.internal.app.IBatteryStats] 95 netd: [android.net.INetd] 96 media.resource_manager: [android.media.IResourceManagerService] 97 media.player: [android.media.IMediaPlayerService] 98 media.drm: [android.media.IMediaDrmService] 99 media.sound_trigger_hw: [android.hardware.ISoundTriggerHwService] 100 media.radio: [android.hardware.IRadioService] 101 media.audio_policy: [android.media.IAudioPolicyService] 102 media.extractor: [android.media.IMediaExtractorService] 103 media.audio_flinger: [android.media.IAudioFlinger] 104 drm.drmManager: [drm.IDrmManagerService] 105 media.camera: [android.hardware.ICameraService] 106 media.codec: [android.media.IMediaCodecService] 107 android.service.gatekeeper.IGateKeeperService: [android.service.gatekeeper.IGateKeeperService] 108 android.security.keystore: [android.security.IKeystoreService] 109 gpu: [android.ui.IGpuService] 110 SurfaceFlinger: [android.ui.ISurfaceComposer] 111 batteryproperties: [android.os.IBatteryPropertiesRegistrar]
In the mean time a screenshot to celebrate.
Thursday 31 January 2019
Binder driver protocol does not match user space protocol
After updating my Kernel 4.4 branch and also Android repo syncing of Nougat I started getting Binder driver protocol does not match user space protocol.
Log of my work follows:
Next step is to fix the hwcomposer not found issue. Let us see how that goes.
Log of my work follows:
- Updating kernel headers in bionic is the first step which was highlighted in my previous post
- Next I started snooping around and found that frameworks/libs/binder/ProcessState.cpp checks the version and then fails
- I wrote a simple C program to check what version the binder driver and the ioctl responds with Version 8
- Next I check the kernel headers and find that there is a version switch when BINDER_IPC_32BIT is defined or something else possibly BINDER_IPC_64BIT Ref: https://elixir.bootlin.com/linux/v4.4/source/include/uapi/linux/android/binder.h#L43 and https://elixir.bootlin.com/linux/v4.4/source/include/uapi/linux/android/binder.h#L94
- Changed it in the source external/kernel-headers/original/....../binder.h and commented out the BINDER_IPC_32BIT and kept only the 64 bit. This is because the kernel has moved on to 64 bit and there is no support for 32 bit. Due to this the KConfig variable is removed. I have still experiment by manually modifying the .config variable
- Ran tools/update_all.py and finally rebuilt the whole AOSP.
Next step is to fix the hwcomposer not found issue. Let us see how that goes.
Wednesday 30 January 2019
Updating kernel headers in the AOSP
I updated Linux Kernel 4.4 to the latest revision. I am now trying with AOSP kernel rather than the linux stable kernel.
To update the kernel headers I follow this excellent guide:
https://android.googlesource.com/platform/bionic/+/master/libc/kernel/README.TXT
I am now fixing the errors after the update. I will be updating my progress soon.
To update the kernel headers I follow this excellent guide:
https://android.googlesource.com/platform/bionic/+/master/libc/kernel/README.TXT
I am now fixing the errors after the update. I will be updating my progress soon.
Tuesday 29 January 2019
Timed out waiting for device dev-ttyO0.device
While booting my Beaglebone black on debian Rootfs I stumbled upon the following problem:
"Timed out waiting for device dev-ttyO0.device"
To fix this enable CONFIG_FHANDLE in the kernel.
Credits: https://medium.com/@madhav2code/timed-out-waiting-for-device-dev-ttys0-device-827391917c5d
"Timed out waiting for device dev-ttyO0.device"
To fix this enable CONFIG_FHANDLE in the kernel.
Credits: https://medium.com/@madhav2code/timed-out-waiting-for-device-dev-ttys0-device-827391917c5d
Thursday 14 June 2018
Flex crash while building AOSP
I encountered a Flex crash while building AOSP. The crash as follows:
[ 1% 618/35534] Lex: aidl <= system/tools/aidl/aidl_language_l.ll
FAILED: /bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_l.cpp system/tools/aidl/aidl_language_l.ll"
flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)
Turns out this is because LC_ALL is set to nothing in my machine in Ubuntu 18.04. You can see this variable by typing "locale" in the command line. To fix this just do a:
export LC_ALL=C
The solution reference is here: https://stackoverflow.com/questions/49301627/android-7-1-2-armv7
[ 1% 618/35534] Lex: aidl <= system/tools/aidl/aidl_language_l.ll
FAILED: /bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/host/linux-x86/obj/STATIC_LIBRARIES/libaidl-common_intermediates/aidl_language_l.cpp system/tools/aidl/aidl_language_l.ll"
flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)
Turns out this is because LC_ALL is set to nothing in my machine in Ubuntu 18.04. You can see this variable by typing "locale" in the command line. To fix this just do a:
export LC_ALL=C
The solution reference is here: https://stackoverflow.com/questions/49301627/android-7-1-2-armv7
Subscribe to:
Posts (Atom)