Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. 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. 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
  3. I repharsed that sentence, I was talking about WiFi powersave polling, check my github comments for more details. In the current version, it is active but somewhat broken, and in idle uses about 200mW more than it needs to. On the other hand if you switch powersave mode fully off, the XR819 uses 300mW more in idle than the current driver. My patches enable setting powersave mode from userspace with iwconfig, and so power consumption can go up quite a bit if powersave is not ON by default. OPZ idle at 816MHz, WiFi driver not loaded: 610mW Connected to WiFi network & idle/no traffic: Current XR819 driver armbian/karabek: 910mW (slightly broken powersave) My patch: 700mW (powersave ON) My patch: 1220mW (powersave OFF, enables low latency incoming pings) Unfortunately, I believe kernel modules are not redistributable as compiled binaries, I think they only load if the kernel version matches perfectly.
  4. 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. On the H2 (the same is true for most modern ARM chips) there is almost no benefit to lowering the clock rate by itself if the CPU has idle periods. If the CPU is IDLE, it pretty much halts and will use the same amount of power, no matter the clock rate. The savings really come from changing the core voltage, which can be lower at low clock rates. With a proper power management controller, the voltage can be matched to the clock in many steps, but on the ZeroPi there are only 2 states: 1.1V and 1.3V. It switches to the higher voltage when the CPU is clocked higher than 816MHz, so on the OPZ you lose almost nothing by limiting the range of the ondemand governor to 816MHz - 1008MHz. Unless you have a realtime application that never allows the CPU to sleep, I don't think there is any point to a lower clock than 816MHz.
  6. Did you make sure there isn't also getty running on ttyS3?
  7. UART2 with TX/RX should work out of the box if you enable the "uart2" overlay in armbianEnv.txt. I see you also have uart3 activated, afaik this port is not routed out on a OPZ. RTS/CTS for UART2 is missing at the moment, but you can add it to the device tree manually. Create the file "uart2_rtscts_fix.dts" in your home folder: /dts-v1/; /plugin/; / { compatible = "allwinner,sun8i-h3"; fragment@0 { target = <&pio>; __overlay__ { uart2_rts_cts: uart2_rts_cts { pins = "PA2", "PA3"; function = "uart2"; }; }; }; }; Then run this to compile and add the custom overlay it to the device tree: armbian-add-overlay uart2_rtscts_fix.dts You need to keep param_uart2_rtscts=1, and on the next reboot, the error should be gone. Edit: Oh and systemd likes to start a getty shell on all serial ports, so you may need to kill that service to make the port usable: systemctl stop serial-getty@ttyS2.service
  8. 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/
  9. @nairn62 the solution in the post above yours is the easiest, and addresses the issue directly (xradio driver doesn't allow setting mac from user space) - iwd is still not quite ready
  10. 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
  11. I don't think I had to run anything else than the 3 lines I posted and reboot.
  12. Thanks, that turned out be a good place to look. On a hunch, I tried swapping out wpa_supplicant for iwd as the wifi daemon for NetworkManager, and that did the trick. apt install iwd systemctl disable wpa_supplicant echo -e "\n[device]\nwifi.backend=iwd\n" >> /etc/NetworkManager/NetworkManager.conf I may just stick with iwd, but the root cause is probably that the aging xradio driver is missing support for some ioctl and it may just be a matter of time until a future release of iwd will send that one too.
  13. I've done some work on kernel drivers and uboot in the past, that would not be a problem. My point is that the XR819 worked on Armbian as good as the chip allows two months ago, and now the driver doesn't even initialize properly. The fact that it stopped working on the old 4.19 kernel branch too, makes me think this is probably not a problem with kernel patches but with the system image. I'm happy to help, but I'm looking for some pointers.
  14. I did, and did not find anything relevant to this particular problem. Can you point me to it? I'm not complaining about the general unreliability of the XR819, I am well aware.
  15. Is it possible that there have been some image changes that broke the XR819 wifi completely? The available images for download on the Armbian page (5.3 server, and 5.4 minimal) as well as a custom built "legacy" branch linux-4.19 image all show the same behavior, The wlan0 interface is not active and it's not possible to bring it up. And dmesg shows that module has been initialized but not much more. Armbianmonitor support info: 5.3.9 official buster server image: http://ix.io/240Y 4.19.88 self-built, two days ago, legacy branch: http://ix.io/240U Everything below is from the official image, but the 4.19 image shows the exact same It is definitely not a hardware issue, I have a SD card with a an older 4.19.72 image (when the branch was still called "next") that works just fine. ifconfig -a ifconfig root@orangepizero:~# ifconfig wlan0 up SIOCSIFFLAGS: Invalid argument root@orangepizero:~# rfkill list 0: phy0: Wireless LAN Soft blocked: no Hard blocked: no root@orangepizero:~# journalctl -b | grep xradio Nov 19 08:08:00 orangepizero kernel: xradio_wlan mmc1:0001:1: Input buffers: 30 x 1632 bytes Nov 19 08:08:00 orangepizero kernel: xradio_wlan mmc1:0001:1: Firmware Label:XR_C01.08.0043 Jun 6 2016 20:41:04 Nov 19 08:08:28 orangepizero NetworkManager[1057]: <info> [1574150908.3204] rfkill0: found WiFi radio killswitch (at /sys/devices/platform/soc/1c10000.mmc/mmc_host/mmc1/mmc1:0001/mmc1:0001:1/ieee80211/phy0/rfkill0) (driver xradio_wlan) root@orangepizero:~# uname -a Linux orangepizero 5.3.9-sunxi #19.11.3 SMP Mon Nov 18 18:49:43 CET 2019 armv7l GNU/Linux
  • Create New...