yoq

  • Content Count

    17
  • Joined

  • Last visited

Reputation Activity

  1. Like
    yoq got a reaction from gounthar in Orange Pi Zero LTS Incorrect Temps Reported   
    I decompiled sun8i_thermal.ko, not sure what I was expecting...
    This is the entirety of their "fix" compared to stock armbian: https://gist.github.com/dbeinder/6c4dac8df91fb4b1b1537bafa8136065/revisions
    Yep, that's just a +30C offset shoved straight into the function, couldn't even be bothered with putting it into the struct for H2/H3, never mind chip detection...
    > "BREAKING: Our engineer has solved the incorrect temperature Report about Zero LTS boards"
    Good job, Xunlong, nice one
  2. Like
    yoq got a reaction from Werner in Improved XR819 driver   
    I know most of you probably don't want to hear any more about this chip, but I recently fixed quite a few long standing issues.
    It's not perfect yet, but it improves scanning/reliable reconnect, incoming frames missed in powersave, ping times, and rate selection.
    Here's the patch set: https://github.com/fifteenhex/xradio/pull/12
    Edit: rebased from karabek: https://github.com/dbeinder/xradio/commits/karabek_rebase
    And some important comments about powersave: https://github.com/fifteenhex/xradio/pull/11#issuecomment-616226880
    In short, relative to the current version, with powersave on, idle consumption is lower by 200mW, but with powersave off, it is 300mW higher
    - so that should be a consideration if you want to integrate this into Armbian builds for tiny boards like OPZero.

    Of course a 65MBit chip will never be fast, but I'd say it is pretty usable as an IoT node now. This hasn't seen much testing,  so your comments are appreciated.
  3. Like
    yoq got a reaction from Werner in Improved XR819 driver   
    Alright, I rebased my changes on karabek's repository: https://github.com/dbeinder/xradio/tree/karabek_rebase
    The powersave commit is now split, with the power-lowering fix in the first part, and enabling userspace control over powersave in the second.

    After some more direct comparison, I'm starting to think the part about removing driver-level TX rate selection doesn't make a measurable difference, in either throughput or dropped packets.
    But since my much simpler code doesn't seem to make it worse either, I think that was just hacks built around the CW11x0 and simply never removed.
    But as long as there is no upside,  it's probably better not to diverge too much from the CW1200 mainline version, so I left that in a separate branch for now: https://github.com/dbeinder/xradio/commits/karabek_rebase_minstrel
  4. Like
    yoq got a reaction from guidol in Improved XR819 driver   
    I know most of you probably don't want to hear any more about this chip, but I recently fixed quite a few long standing issues.
    It's not perfect yet, but it improves scanning/reliable reconnect, incoming frames missed in powersave, ping times, and rate selection.
    Here's the patch set: https://github.com/fifteenhex/xradio/pull/12
    Edit: rebased from karabek: https://github.com/dbeinder/xradio/commits/karabek_rebase
    And some important comments about powersave: https://github.com/fifteenhex/xradio/pull/11#issuecomment-616226880
    In short, relative to the current version, with powersave on, idle consumption is lower by 200mW, but with powersave off, it is 300mW higher
    - so that should be a consideration if you want to integrate this into Armbian builds for tiny boards like OPZero.

    Of course a 65MBit chip will never be fast, but I'd say it is pretty usable as an IoT node now. This hasn't seen much testing,  so your comments are appreciated.
  5. Like
    yoq got a reaction from Igor in Improved XR819 driver   
    I know most of you probably don't want to hear any more about this chip, but I recently fixed quite a few long standing issues.
    It's not perfect yet, but it improves scanning/reliable reconnect, incoming frames missed in powersave, ping times, and rate selection.
    Here's the patch set: https://github.com/fifteenhex/xradio/pull/12
    Edit: rebased from karabek: https://github.com/dbeinder/xradio/commits/karabek_rebase
    And some important comments about powersave: https://github.com/fifteenhex/xradio/pull/11#issuecomment-616226880
    In short, relative to the current version, with powersave on, idle consumption is lower by 200mW, but with powersave off, it is 300mW higher
    - so that should be a consideration if you want to integrate this into Armbian builds for tiny boards like OPZero.

    Of course a 65MBit chip will never be fast, but I'd say it is pretty usable as an IoT node now. This hasn't seen much testing,  so your comments are appreciated.
  6. Like
    yoq reacted to martinayotte in RTS signal and uart2 init   
    This thread reveal some bug present in fixup scripts that were not be updated since introduction of 5.x.y :
     
    I've done some fixes and committed this morning.
    You can either wait for new images, or build yourself a new image, or try to fix the sun8i-h3-fixup.scr yourself manually.
  7. Like
    yoq got a reaction from TRS-80 in How can I set isolated cpu on orange pi zero?   
    You can free up a core using isolcpus kernel parameter and then move your task on the unused core using taskset:
    simply set it by adding extraargs=isolcpus=1 to your /boot/armbianEnv.txt
    https://codywu2010.wordpress.com/2015/09/27/isolcpus-numactl-and-taskset/
  8. Like
    yoq got a reaction from guidol in Orange Pi Zero LTS Incorrect Temps Reported   
    I spent some time investigating this, I think it is a hardware/production issue. There is a calibration value in the eFuse, set during chip production. That value is currently not used in mainline, but in the affected hardware, it does not correct the offset anyway. In my good boards, it only caused a small change that looks reasonable. But the problematic boards are off by 20-30 degrees.
    I wrote a small python3 script to access the hardware directly, it will print a dump of the THS registers, interpret the raw value into a temperature with all the formulas that were published one time or another, and apply the eFuse factory-calibration value. To see the effect, wait a few seconds and run again.
    import time import os import mmap from sys import exit dev_mem_rw = os.open("/dev/mem", os.O_RDWR | os.O_SYNC) #send reset pulse to the THS subsystem if False: ccu_base = 0x01C20000 mmap_base = int(ccu_base/mmap.PAGESIZE)*mmap.PAGESIZE ccu_registers = mmap.mmap(dev_mem_rw, mmap.PAGESIZE, mmap.MAP_SHARED, mmap.PROT_WRITE, offset=mmap_base) ccu_offset = ccu_base - mmap_base rst_reg3 = ccu_offset + 0x2D0 # bus soft rst reg3 current_state = ccu_registers[rst_reg3+1] ccu_registers[rst_reg3+1] = current_state & 0xFE ccu_registers[rst_reg3+1] = current_state print("Reset THS peripheral") ths_base = 0x01C25000 mmap_base = int(ths_base/mmap.PAGESIZE)*mmap.PAGESIZE ths_offset = ths_base - mmap_base ths_ctrl_reg0 = ths_offset + 0x00 # ctrl reg0 ths_ctrl_reg1 = ths_offset + 0x04 # ctrl reg1 ths_cdat_reg = ths_offset + 0x14 # ADC cal data ths_ctrl_reg2 = ths_offset + 0x40 # ctrl reg2 ths_int_ctrl = ths_offset + 0x44 # interrupt ctrl ths_stat_reg = ths_offset + 0x48 # status reg ths_alarm_ctrl = ths_offset + 0x50 # alarm ctrl ths_shdn_ctrl = ths_offset + 0x60 # shutdown ctrl ths_filter_ctrl = ths_offset + 0x70 # filter reg ths_cdata_reg = ths_offset + 0x74 # calibration data register ths_data_reg = ths_offset + 0x80 # thermal sensor data register ths_registers = mmap.mmap(dev_mem_rw, mmap.PAGESIZE, mmap.MAP_SHARED, mmap.PROT_WRITE, offset=mmap_base) regs = { "ctrl0": ths_ctrl_reg0, "ctrl1": ths_ctrl_reg1, "cdat": ths_cdat_reg, "ctrl2": ths_ctrl_reg2, "int_ctrl": ths_int_ctrl, "stat": ths_stat_reg, "alarm": ths_alarm_ctrl, "shdn": ths_shdn_ctrl, "filter": ths_filter_ctrl, "cdata": ths_cdata_reg, "data": ths_data_reg } def dmp(): for name, r in regs.items(): b = ths_registers[r:r+4] x = int.from_bytes(b, byteorder='little') print(f"{name:10}{b[3]:02X} {b[2]:02X} {b[1]:02X} {b[0]:02X}\t{x}") adc_data = ths_registers[ths_data_reg:ths_data_reg+2] adc_value = int.from_bytes(adc_data, byteorder='little') print(f"ADC value: {adc_value}") t_ds = (adc_value-2794)/(-14.882) print(f"H2/H3 datasheet formula: {t_ds:.1f}C") t_h5 = -0.1191 * adc_value + 223 print(f"H5 datasheet formula: {t_h5:.1f}C") t_bsp1 = -0.1180 * adc_value + 256 print(f"BSP v4.9 formula: {t_bsp1:.1f}C") t_bsp2 = -0.1211 * adc_value + 217 print(f"mainline & xunlong kernel: {t_bsp2:.1f}C") with open("/sys/devices/virtual/thermal/thermal_zone0/temp", "r") as f: t_kernel = int(f.read()) / 1000.0 print(f"Running Kernel: {t_kernel:.1f}C") print("\nTHS Registers:") dmp() cal_value = int.from_bytes(ths_registers[ths_cdata_reg:ths_cdata_reg+4], "little") print(f"\nCurrent THS calibration value: 0x{cal_value:3x}") with open("/sys/bus/nvmem/devices/sunxi-sid0/nvmem", "rb") as f: f.seek(0x34) fuse_cal_value = int.from_bytes(f.read(4), "little") print(f"EFuse THS calibration value: 0x{fuse_cal_value:3x}") if cal_value != fuse_cal_value: ths_registers[ths_cdata_reg:ths_cdata_reg+4] = fuse_cal_value.to_bytes(4, "little") delta = (fuse_cal_value-cal_value)*0.1211 print(f"Applied calibration value from EFuse, this causes a change of {delta:.1f} deg C") #ths_registers[ths_ctrl_reg0:ths_ctrl_reg0+4] = (0xFF).to_bytes(4, "little") # 16x averaging #ths_registers[ths_filter_ctrl:ths_filter_ctrl+4] = (0x07).to_bytes(4, "little") # ADC calibration, seems to do nothing? #ths_registers[ths_ctrl_reg1:ths_ctrl_reg1+4] = ((1 << 17) | (0 << 20)| (0 << 21)).to_bytes(4, "little") # stop #ths_registers[ths_ctrl_reg2:ths_ctrl_reg2+4] = (4128769-1).to_bytes(4, "little") # start #ths_registers[ths_ctrl_reg2:ths_ctrl_reg2+4] = (4128769).to_bytes(4, "little") You'll have to run it as root because it accesses the memory directly.
    H2+ datasheet: http://wiki.friendlyarm.com/wiki/images/0/08/Allwinner_H2%2B_Datasheet_V1.2.pdf (THS is on page 255)
    I left in some stuff in the script to control the hardware, if anyone wants to play with it without messing with the kernel

    Good board, SoC temperature measured with thermocouple at 46°C: 
    ADC value: 1414 H2/H3 datasheet formula: 92.7C H5 datasheet formula: 54.6C BSP v4.9 formula: 89.1C mainline & xunlong kernel: 45.8C Running Kernel: 45.6C THS Registers: ctrl0 00 00 00 FF 255 ctrl1 00 00 00 00 0 cdat 00 00 00 00 0 ctrl2 00 3F 00 01 4128769 int_ctrl 00 00 71 00 28928 stat 00 00 00 00 0 alarm 05 A0 06 84 94373508 shdn 04 E9 00 00 82378752 filter 00 00 00 06 6 cdata 00 00 08 00 2048 data 00 00 05 86 1414 Current THS calibration value: 0x800 EFuse THS calibration value: 0x817 Applied calibration value from EFuse, this causes a change of 2.8 deg C Affected LTS board, SoC temperature on top: 47°C:
    ADC value: 1626 H2/H3 datasheet formula: 78.5C H5 datasheet formula: 29.3C BSP v4.9 formula: 64.1C mainline & xunlong kernel: 20.1C Running Kernel: 20.0C THS Registers: ctrl0 00 00 00 FF 255 ctrl1 00 00 00 00 0 cdat 00 00 00 00 0 ctrl2 00 3F 00 01 4128769 int_ctrl 00 00 71 00 28928 stat 00 00 00 00 0 alarm 05 A0 06 84 94373508 shdn 04 E9 00 00 82378752 filter 00 00 00 06 6 cdata 00 00 08 00 2048 data 00 00 06 5A 1626 Current THS calibration value: 0x800 EFuse THS calibration value: 0x7fb Applied calibration value from EFuse, this causes a change of -0.6 deg C  
  9. Like
    yoq reacted to karabek in OPi Zero: XR819 wifi broken in new builds   
    Users wanting to use debian builds with NetworkManager/wpa_supplicant should add the following lines to /etc/NetworkManager/NetworkManager.conf:
    [device] wifi.scan-rand-mac-address=no Ubuntu builds (bionic, focal) already contain these lines.
     
    This seems to solve the current issue on systems with the xradio wifi chip (opi zero, nanopi duo etc.)
  10. Like
    yoq reacted to martinayotte in OPi Zero: XR819 wifi broken in new builds   
    In my case, I'm using "old school" /etc/network/interface, running Stretch 5.4.2, and WiFi running properly as soon as I disabled NetworkManager service.
  11. Like
    yoq reacted to raschid in OPi Zero: XR819 wifi broken in new builds   
    Yeah. XR819-Wifi stopped working with stretch and buster, but still works with bionic.
     
    Here's my syslog with a buster build:
    ov 30 16:45:56 localhost NetworkManager[1116]: <info> [1575132356.6690] wifi-nl80211: (wlan0): using nl80211 for WiFi device control Nov 30 16:45:58 localhost NetworkManager[1116]: <info> [1575132358.1449] device (wlan0): driver supports Access Point (AP) mode Nov 30 16:45:58 localhost NetworkManager[1116]: <info> [1575132358.1555] manager: (wlan0): new 802.11 WiFi device (/org/freedesktop/NetworkManager/Devices/4) Nov 30 16:45:58 localhost NetworkManager[1116]: <info> [1575132358.1656] device (wlan0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external') Nov 30 16:45:58 localhost kernel: [ 34.419112] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready Nov 30 16:45:58 localhost kernel: [ 34.423469] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready Nov 30 16:45:58 localhost NetworkManager[1116]: <info> [1575132358.1790] device (wlan0): set-hw-addr: set MAC address to AA:88:8F:8F:8F:AF (scanning) Nov 30 16:45:58 localhost NetworkManager[1116]: <info> [1575132358.2924] device (wlan0): supplicant interface state: init -> starting Nov 30 16:45:58 localhost wpa_supplicant[1115]: Could not set interface wlan0 flags (UP): Invalid argument Nov 30 16:45:58 localhost wpa_supplicant[1115]: nl80211: Could not set interface 'wlan0' UP Nov 30 16:45:58 localhost wpa_supplicant[1115]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0 Nov 30 16:45:58 localhost wpa_supplicant[1115]: Could not set interface wlan0 flags (UP): Invalid argument Nov 30 16:45:58 localhost wpa_supplicant[1115]: WEXT: Could not set interface 'wlan0' UP Nov 30 16:45:58 localhost wpa_supplicant[1115]: wlan0: Failed to initialize driver interface Nov 30 16:45:58 localhost NetworkManager[1116]: <error> [1575132358.3304] sup-iface[0x1175c18,wlan0]: error adding interface: wpa_supplicant couldn't grab this interface. Nov 30 16:45:58 localhost NetworkManager[1116]: <info> [1575132358.3309] device (wlan0): supplicant interface state: starting -> down Nov 30 17:21:39 localhost NetworkManager[1116]: <warn> [1575134499.3085] device (wlan0): re-acquiring supplicant interface (#1).