Novastar MCTRL300 basic control software

Code can be found at the Github repository. Builds/executables are not available but if anyone has use for them, I’d happily create one for you…

What?

Simple, basic control of brightness and test patterns/mode for the Novastar MCTRL300 (and possibly others, but I don’t have others to test).

It does not allow you to configure your screen. It can be used during testing or (I can imagine) to give just this piece of software to a client to let him dim the screen when no technician is available.

Why?

I repair several types of LED panels, among which are Desay 6mm and UPAD 2.6mm.

The Novastar software is written for Windows and overkill for simple control of patterns and brightness (which is all I need during testing and repair). This PyQt based solution works faster and runs on my Linux machines as well instead of having to set up a virtual machine (or Wine).

Novastar hardware: the MCTRL300 LED controller

The Novastar MCTRL300 controller that can be used to drive these panels has a Windows software that allows you configure your whole led screen as well as display test patterns (full r/g/b, moving lines, white, …). During repair and testing this last function is something I use all the time. Thus, the software with all its functions is overkill and rather cumbersome. I decided to write my own (simple) interface to call up test patterns quickly.

The controller has a Silicon Labs CP2102 USB to UART bridge. Opening the housing reveals a rather pretty board that seems to be made so that it can be used as a PCI extention card in a computer instead of a standalone controller as well. Soldering a couple of wires to the QFN28 package and connecting a logic analyzer allows to log the commands that are sent to the controller. After getting these commands, only a bit of Python remains to be written.

Example

Screenshot of beta version

Thanks / Acknowledgements

I found a couple of useful documents about the protocol Novastar uses for a couple of other of their controllers on the Bitfocus Companion module novastar controller repository, mostly while reading through the issues.

DIY active / HiZ / high impedance probe design.

I’ve been wanting to have an high-impedance (Hi-Z) probe for some time now. 

Up until now I’ve been searching for something like an HP 85024a which comes up on the secondhand market from time to time. It would be overkill for my needs, but still nice… :)

Recently I came across an old Elektor/Elektuur article from April 2004 titled “Poor man’s 1GHz active probe” by David Jewsbury. Some more research turned up the bachelor thesis of Thomas Hirschbuechler titled “Design of a low-cost 1GHz active probe“.

I decided it would be a good learning experience to try and recreate/adapt the design and make some measurements on it. 

Design

The board measures 60 by 25mm. As I do not intend to use the probe up to 1GHz I did not bother to use Rogers or some other high-performance material and opted for regular FR4. Design is done in Diptrace V4 which I can recommend as an easy-to-learn EDA.

The current state of the design is in my Github repository although I need to update the schematic with the revisions I made during prototyping.

v0.1prototype board with many changes.

The total cost of the current version is well below €50 where the SMA connector is probably the most expensive part.

Measurements

After tweaking and making some changes on the initial design, measurements turned out pretty good (taking in to account thatI do not intend to use the probe much above 200-300MHz). I made a bode plot 0-25MHz with my MSO5074 scope which has a 25MHz signal generator build-in:

Bode plot to 25MHz

For higher frequenties I turned to my 300kHz-1.3GHz HP vector network analyser (csv at the end):

S21 and S11 from 300kHz to 1GHz
Frequency(MHz); S21(Log Mag),dB;  S11(Log Mag),dB

0.300;         -33.06;            -0.38
5.298;         -20.14;             0.00
10.297;        -17.76;            -0.08
15.296;        -17.05;            -0.16
20.294;        -16.81;            -0.33
25.293;        -16.79;            -0.45
30.291;        -16.85;            -0.55
35.289;        -16.90;            -0.59
40.288;        -16.91;            -0.62
45.286;        -16.89;            -0.61
50.285;        -16.79;            -0.59
55.283;        -16.68;            -0.60
60.282;        -16.60;            -0.64
65.281;        -16.58;            -0.73
70.279;        -16.62;            -0.81
75.278;        -16.78;            -0.87
80.276;        -16.96;            -0.87
85.275;        -17.11;            -0.85
90.273;        -17.16;            -0.81
95.272;        -17.11;            -0.75
100.270;       -16.96;            -0.76
105.269;       -16.71;            -0.80
110.267;       -16.48;            -0.94
115.266;       -16.36;            -1.13
120.264;       -16.39;            -1.31
125.263;       -16.58;            -1.40
130.261;       -16.85;            -1.42
135.260;       -17.10;            -1.30
140.258;       -17.27;            -1.14
145.256;       -17.31;            -0.99
150.255;       -17.22;            -0.94
155.254;       -17.01;            -0.95
160.252;       -16.78;            -1.12
165.250;       -16.60;            -1.39
170.249;       -16.48;            -1.70
175.248;       -16.52;            -1.94
180.246;       -16.70;            -2.03
185.244;       -16.89;            -1.92
190.243;       -17.07;            -1.67
195.242;       -17.17;            -1.44
200.240;       -17.18;            -1.24
205.238;       -17.10;            -1.16
210.237;       -16.97;            -1.22
215.236;       -16.84;            -1.44
220.234;       -16.74;            -1.75
225.232;       -16.64;            -2.12
230.231;       -16.58;            -2.42
235.230;       -16.58;            -2.47
240.228;       -16.57;            -2.32
245.226;       -16.58;            -2.01
250.225;       -16.63;            -1.72
255.224;       -16.68;            -1.49
260.222;       -16.76;            -1.40
265.221;       -16.83;            -1.47
270.219;       -16.87;            -1.68
275.217;       -16.83;            -2.03
280.216;       -16.73;            -2.40
285.214;       -16.56;            -2.68
290.213;       -16.40;            -2.77
295.212;       -16.30;            -2.61
300.210;       -16.31;            -2.27
305.209;       -16.43;            -1.91
310.207;       -16.58;            -1.65
315.205;       -16.75;            -1.51
320.204;       -16.82;            -1.54
325.202;       -16.76;            -1.74
330.201;       -16.58;            -2.10
335.200;       -16.31;            -2.58
340.198;       -16.05;            -3.04
345.197;       -15.94;            -3.27
350.195;       -16.00;            -3.15
355.193;       -16.24;            -2.72
360.192;       -16.51;            -2.22
365.190;       -16.74;            -1.83
370.189;       -16.85;            -1.62
375.188;       -16.80;            -1.59
380.186;       -16.59;            -1.79
385.185;       -16.27;            -2.20
390.183;       -15.90;            -2.83
395.182;       -15.63;            -3.51
400.180;       -15.54;            -3.96
405.178;       -15.62;            -3.83
410.177;       -15.85;            -3.21
415.175;       -16.09;            -2.48
420.174;       -16.27;            -1.93
425.173;       -16.35;            -1.65
430.171;       -16.30;            -1.63
435.170;       -16.15;            -1.90
440.168;       -15.93;            -2.45
445.166;       -15.70;            -3.19
450.165;       -15.54;            -3.97
455.163;       -15.46;            -4.34
460.162;       -15.48;            -4.02
465.161;       -15.58;            -3.20
470.159;       -15.69;            -2.36
475.158;       -15.81;            -1.75
480.156;       -15.88;            -1.49
485.154;       -15.85;            -1.53
490.153;       -15.75;            -1.88
495.151;       -15.56;            -2.50
500.150;       -15.31;            -3.34
505.149;       -15.03;            -4.15
510.147;       -14.77;            -4.45
515.145;       -14.62;            -3.93
520.144;       -14.59;            -2.93
525.143;       -14.76;            -2.02
530.141;       -15.01;            -1.48
535.139;       -15.30;            -1.27
540.138;       -15.47;            -1.38
545.136;       -15.52;            -1.77
550.135;       -15.42;            -2.40
555.134;       -15.16;            -3.19
560.132;       -14.85;            -3.91
565.130;       -14.51;            -4.17
570.129;       -14.30;            -3.68
575.128;       -14.22;            -2.80
580.126;       -14.35;            -1.92
585.125;       -14.54;            -1.39
590.123;       -14.75;            -1.17
595.121;       -14.85;            -1.27
600.120;       -14.86;            -1.63
605.119;       -14.73;            -2.22
610.117;       -14.50;            -2.97
615.115;       -14.20;            -3.69
620.114;       -13.94;            -4.06
625.112;       -13.76;            -3.74
630.111;       -13.73;            -2.86
635.110;       -13.86;            -1.96
640.108;       -14.06;            -1.33
645.106;       -14.23;            -1.09
650.105;       -14.34;            -1.11
655.104;       -14.35;            -1.43
660.102;       -14.22;            -1.98
665.101;       -13.98;            -2.80
670.099;       -13.65;            -3.72
675.097;       -13.32;            -4.27
680.096;       -13.06;            -3.99
685.095;       -12.93;            -2.96
690.093;       -12.98;            -1.85
695.091;       -13.18;            -1.06
700.090;       -13.42;            -0.69
705.088;       -13.58;            -0.69
710.087;       -13.61;            -1.04
715.086;       -13.46;            -1.73
720.084;       -13.14;            -2.69
725.082;       -12.71;            -3.77
730.081;       -12.26;            -4.40
735.080;       -11.98;            -3.87
740.078;       -11.91;            -2.54
745.077;       -12.14;            -1.27
750.075;       -12.49;            -0.48
755.073;       -12.85;            -0.17
760.072;       -13.07;            -0.33
765.071;       -13.13;            -0.83
770.069;       -12.98;            -1.68
775.067;       -12.64;            -2.81
780.066;       -12.18;            -3.99
785.064;       -11.75;            -4.41
790.063;       -11.46;            -3.46
795.062;       -11.37;            -1.86
800.060;       -11.48;            -0.62
805.058;       -11.69;             0.02
810.057;       -11.90;             0.07
815.056;       -12.02;            -0.37
820.054;       -12.07;            -1.25
825.053;       -12.08;            -2.47
830.051;       -12.06;            -3.95
835.049;       -12.09;            -5.28
840.048;       -12.13;            -5.44
845.047;       -12.16;            -4.01
850.045;       -12.16;            -2.23
855.043;       -12.16;            -0.88
860.042;       -12.24;            -0.25
865.040;       -12.36;            -0.19
870.039;       -12.50;            -0.62
875.038;       -12.61;            -1.36
880.036;       -12.64;            -2.42
885.034;       -12.55;            -3.57
890.033;       -12.34;            -4.36
895.032;       -12.05;            -4.07
900.030;       -11.78;            -2.84
905.029;       -11.60;            -1.52
910.027;       -11.61;            -0.67
915.025;       -11.80;            -0.45
920.024;       -12.09;            -0.69
925.023;       -12.37;            -1.35
930.021;       -12.55;            -2.27
935.019;       -12.55;            -3.42
940.018;       -12.39;            -4.53
945.016;       -12.13;            -5.09
950.015;       -11.88;            -4.58
955.014;       -11.74;            -3.37
960.012;       -11.77;            -2.24
965.010;       -11.98;            -1.61
970.009;       -12.27;            -1.54
975.008;       -12.49;            -1.99
980.006;       -12.55;            -2.87
985.005;       -12.38;            -4.19
990.003;       -11.99;            -5.91
995.001;       -11.55;            -7.75
1.000.000;     -11.21;            -8.23

The low frequency response (up to, say, 5MHz) isn’t particulary good. Starting around 5MHz, S21 is fairly flat around -17dB up to 400MHz. From there on it starts to increase.

S11 is between 0 and -4 dB up to 800MHz which I think is very good.

Final thoughts

These results are (much) better than I expected from my first attempt, so I am trying to figure out if I am measuring the correct parameters and whether my interpretation is correct…

Things I’d like to figure out:

  • First of all: are my assumptions regarding the measurements correct?
  • How do I improve the low-frequency response to be more linear?
  • What causes the response (both S21 and S11) to ripple rather continuously? Should I suspect my measurement setup?
  • Would I be better to lower the FET supply voltage (or input bias) in order to end up with an even -20dB gain, so that converting the voltage magnitude would be easier?

I’ll make a v0.2 with the changes and some additional improvements and then a properly shielded enclosure (likely pcb material).

While this is mostly an exercise and learning experience, I’m rather happy with the results so far.

Unilumin Upad 2.6mm led screen repair

I regularly repair tiles of Unilumen 2.6mm Upad that have broken pixels. Since the pixel pitch (distance between the center of the pixels) is only 2.6mm, that leaves only about 0.5mm between the pixels. Not enough for soldering with conventional means. To do this, you do require good eyes or magnification as well as an hot air station.

96×96 pixels on a 25x25cm tile
Example of damage by ripped off pixels as on a tile received by customer. Note the distance between the center of the pixels is only 2.6mm. Pixel dimensions are 2.1×2.1mm.

It took me quite a while to become proficient at replacing the pixels and performing repairs on pads that had been ripped off.

To repair damaged pads, one can use special (very thin) paper-like circuit board that you can order from Unilumen.

In the process of learning how to deal with these repairs, I created some documentation to make this somewhat easier. I wish I would have had these drawings when I started out as this would have allowed me to get better results sooner. As such, I think it is only fair to share these drawings hoping to help someone else. Below are some of my notes documenting orientation as well as traces on the board itself as well as on the paper. Pictures of the paper are taken through a stereoscopic microscope.

Hope this helps someone!

Microcode SW error with an Intel 8265 / 8275 (rev 78) wireless card

The issue:

Multiple times an hour my wireless connection would drop out for a couple of seconds, then come back up. If this happened while streaming media, most often it would not be noticable because the media buffer would handle the hiccup, but during regular surfing this would lead to disconnects or unreachable pages.

Looking through the dmesg output I found plenty of tracebacks similar to this (MAC address of my router removed):

[   22.603623] iwlwifi 0000:04:00.0: Microcode SW error detected.  Restarting 0x2000000.
[   22.605114] iwlwifi 0000:04:00.0: Start IWL Error Log Dump:
[   22.606304] iwlwifi 0000:04:00.0: Status: 0x00000040, count: 6
[   22.607576] iwlwifi 0000:04:00.0: Loaded firmware version: 36.77d01142.0
[   22.608704] iwlwifi 0000:04:00.0: 0x000014FD | ADVANCED_SYSASSERT          
[   22.609791] iwlwifi 0000:04:00.0: 0x000002F0 | trm_hw_status0
[   22.610872] iwlwifi 0000:04:00.0: 0x00000000 | trm_hw_status1
[   22.611968] iwlwifi 0000:04:00.0: 0x000248EC | branchlink2
[   22.613058] iwlwifi 0000:04:00.0: 0x0003A862 | interruptlink1
[   22.614170] iwlwifi 0000:04:00.0: 0x00000000 | interruptlink2
[   22.615272] iwlwifi 0000:04:00.0: 0x00000082 | data1
[   22.616343] iwlwifi 0000:04:00.0: 0xDEADBEEF | data2
[   22.617448] iwlwifi 0000:04:00.0: 0xDEADBEEF | data3
[   22.618475] iwlwifi 0000:04:00.0: 0x0009505C | beacon time
[   22.619232] iwlwifi 0000:04:00.0: 0x00378063 | tsf low
[   22.620219] iwlwifi 0000:04:00.0: 0x00000000 | tsf hi
[   22.621186] iwlwifi 0000:04:00.0: 0x00000000 | time gp1
[   22.622329] iwlwifi 0000:04:00.0: 0x00378064 | time gp2
[   22.623512] iwlwifi 0000:04:00.0: 0x00000001 | uCode revision type
[   22.624557] iwlwifi 0000:04:00.0: 0x00000024 | uCode version major
[   22.625464] iwlwifi 0000:04:00.0: 0x77D01142 | uCode version minor
[   22.626252] iwlwifi 0000:04:00.0: 0x00000230 | hw version
[   22.626792] iwlwifi 0000:04:00.0: 0x00C89000 | board version
[   22.627331] iwlwifi 0000:04:00.0: 0x003D0108 | hcmd
[   22.627883] iwlwifi 0000:04:00.0: 0x00022080 | isr0
[   22.628434] iwlwifi 0000:04:00.0: 0x00000000 | isr1
[   22.628989] iwlwifi 0000:04:00.0: 0x08201802 | isr2
[   22.629538] iwlwifi 0000:04:00.0: 0x00400080 | isr3
[   22.630588] iwlwifi 0000:04:00.0: 0x00000000 | isr4
[   22.631341] iwlwifi 0000:04:00.0: 0x003C019F | last cmd Id
[   22.631846] iwlwifi 0000:04:00.0: 0x00000000 | wait_event
[   22.632347] iwlwifi 0000:04:00.0: 0x0000D5E7 | l2p_control
[   22.632844] iwlwifi 0000:04:00.0: 0x00000000 | l2p_duration
[   22.633334] iwlwifi 0000:04:00.0: 0x00000000 | l2p_mhvalid
[   22.633835] iwlwifi 0000:04:00.0: 0x00000000 | l2p_addr_match
[   22.634745] iwlwifi 0000:04:00.0: 0x0000008F | lmpm_pmg_sel
[   22.635664] iwlwifi 0000:04:00.0: 0x08081421 | timestamp
[   22.636676] iwlwifi 0000:04:00.0: 0x00004050 | flow_handler
[   22.637518] iwlwifi 0000:04:00.0: Start IWL Error Log Dump:
[   22.638372] iwlwifi 0000:04:00.0: Status: 0x00000040, count: 7
[   22.638861] iwlwifi 0000:04:00.0: 0x00000070 | NMI_INTERRUPT_LMAC_FATAL
[   22.639341] iwlwifi 0000:04:00.0: 0x00000000 | umac branchlink1
[   22.639813] iwlwifi 0000:04:00.0: 0xC0086948 | umac branchlink2
[   22.640278] iwlwifi 0000:04:00.0: 0xC0083B0C | umac interruptlink1
[   22.640745] iwlwifi 0000:04:00.0: 0xC0083B0C | umac interruptlink2
[   22.641211] iwlwifi 0000:04:00.0: 0x00000800 | umac data1
[   22.641693] iwlwifi 0000:04:00.0: 0xC0083B0C | umac data2
[   22.642655] iwlwifi 0000:04:00.0: 0xDEADBEEF | umac data3
[   22.643476] iwlwifi 0000:04:00.0: 0x00000024 | umac major
[   22.644376] iwlwifi 0000:04:00.0: 0x77D01142 | umac minor
[   22.645316] iwlwifi 0000:04:00.0: 0xC088628C | frame pointer
[   22.646226] iwlwifi 0000:04:00.0: 0xC088628C | stack pointer
[   22.647072] iwlwifi 0000:04:00.0: 0x003D0108 | last host cmd
[   22.647786] iwlwifi 0000:04:00.0: 0x00000000 | isr status reg
[   22.648611] iwlwifi 0000:04:00.0: Fseq Registers:
[   22.649236] iwlwifi 0000:04:00.0: 0xE5A33CD7 | FSEQ_ERROR_CODE
[   22.649769] iwlwifi 0000:04:00.0: 0x356D75C8 | FSEQ_TOP_INIT_VERSION
[   22.650294] iwlwifi 0000:04:00.0: 0x2408A24F | FSEQ_CNVIO_INIT_VERSION
[   22.650818] iwlwifi 0000:04:00.0: 0x0000A10B | FSEQ_OTP_VERSION
[   22.651341] iwlwifi 0000:04:00.0: 0x7D82B21C | FSEQ_TOP_CONTENT_VERSION
[   22.651867] iwlwifi 0000:04:00.0: 0xBADED74E | FSEQ_ALIVE_TOKEN
[   22.652391] iwlwifi 0000:04:00.0: 0x21AF7C59 | FSEQ_CNVI_ID
[   22.652914] iwlwifi 0000:04:00.0: 0x32D8E512 | FSEQ_CNVR_ID
[   22.653434] iwlwifi 0000:04:00.0: 0x00000010 | CNVI_AUX_MISC_CHIP
[   22.653957] iwlwifi 0000:04:00.0: 0x0BADCAFE | CNVR_AUX_MISC_CHIP
[   22.654477] iwlwifi 0000:04:00.0: 0x0BADCAFE | CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM
[   22.654998] iwlwifi 0000:04:00.0: 0x0BADCAFE | CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR
[   22.655522] iwlwifi 0000:04:00.0: Collecting data: trigger 2 fired.
[   22.655526] ieee80211 phy0: Hardware restart was requested
[   22.655589] iwlwifi 0000:04:00.0: iwlwifi transaction failed, dumping registers
[   22.656168] iwlwifi 0000:04:00.0: iwlwifi device config registers:
[   22.657016] iwlwifi 0000:04:00.0: 00000000: 24fd8086 00100406 02800078 00000000 dc000004 00000000 00000000 00000000
[   22.657511] iwlwifi 0000:04:00.0: 00000020: 00000000 00000000 00000000 10108086 00000000 000000c8 00000000 000001ff
[   22.658012] iwlwifi 0000:04:00.0: 00000040: 00020010 10008ec0 00190c10 0045e811 10110142 00000000 00000000 00000000
[   22.658509] iwlwifi 0000:04:00.0: 00000060: 00000000 00080812 00000405 00000000 00010001 00000000 00000000 00000000
[   22.659021] iwlwifi 0000:04:00.0: 00000080: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.659511] iwlwifi 0000:04:00.0: 000000a0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.659999] iwlwifi 0000:04:00.0: 000000c0: 00000000 00000000 c823d001 0d000000 00814005 fee00318 00000000 00000000
[   22.660490] iwlwifi 0000:04:00.0: 000000e0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.660984] iwlwifi 0000:04:00.0: 00000100: 14010001 00000000 00000000 00462031 00000000 00002000 00000000 00000000
[   22.661487] iwlwifi 0000:04:00.0: 00000120: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   22.661988] iwlwifi 0000:04:00.0: 00000140: 14c10003 ff77ed1d 00e18cff 15410018 10031003 0001001e 00481e1f 40a0000f
[   22.662500] iwlwifi 0000:04:00.0: iwlwifi device memory mapped registers:
[   22.663171] iwlwifi 0000:04:00.0: 00000000: 00c89000 00000040 00000000 ba00008b 00000000 00000000 00000010 00000000
[   22.663712] iwlwifi 0000:04:00.0: 00000020: 00000000 08040005 00000230 d55555d5 d55555d5 d55555d5 80008040 041f0042
[   22.664380] iwlwifi 0000:04:00.0: iwlwifi device AER capability structure:
[   22.665072] iwlwifi 0000:04:00.0: 00000000: 14010001 00000000 00000000 00462031 00000000 00002000 00000000 00000000
[   22.665660] iwlwifi 0000:04:00.0: 00000020: 00000000 00000000 00000000
[   22.666231] iwlwifi 0000:04:00.0: iwlwifi parent port (0000:00:1c.6) config registers:
[   22.666902] iwlwifi 0000:00:1c.6: 00000000: 9d168086 00100407 060400f1 00810000 00000000 00000000 00040400 200000f0
///
[   22.677074] iwlwifi 0000:00:1c.6: 00000200: 2201001e 00b0281f 40a0280f
[   22.677731] iwlwifi 0000:04:00.0: iwlwifi root port (0000:00:1c.6) AER cap structure:
[   22.678391] iwlwifi 0000:00:1c.6: 00000000: 14010001 00000000 00010000 00060011 00000000 00002000 00000000 00000000
[   22.679058] iwlwifi 0000:00:1c.6: 00000020: 00000000 00000000 00000000 00000000 00000000 00000000
[   22.679724] iwlwifi 0000:04:00.0: FW error in SYNC CMD PHY_CONTEXT_CMD
[   22.680398] CPU: 2 PID: 1328 Comm: wpa_supplicant Tainted: G           OE     5.4.0-89-generic #100-Ubuntu
[   22.680399] Hardware name: LENOVO 20H9CT01WW/20H9CT01WW, BIOS N1VET56W (1.46 ) 05/17/2021
[   22.680400] Call Trace:
[   22.680405]  dump_stack+0x6d/0x8b
[   22.680415]  iwl_pcie_send_hcmd_sync+0x382/0x390 [iwlwifi]
[   22.680418]  ? wait_woken+0x80/0x80
[   22.680424]  iwl_trans_pcie_send_hcmd+0x34/0xf0 [iwlwifi]
[   22.680430]  iwl_trans_send_cmd+0x55/0xc0 [iwlwifi]
[   22.680438]  iwl_mvm_send_cmd+0x1f/0x40 [iwlmvm]
[   22.680443]  iwl_mvm_send_cmd_pdu+0x51/0x70 [iwlmvm]
[   22.680448]  iwl_mvm_phy_ctxt_apply.constprop.0+0x173/0x240 [iwlmvm]
[   22.680453]  iwl_mvm_phy_ctxt_changed+0x58/0xb0 [iwlmvm]
[   22.680458]  iwl_mvm_change_chanctx+0x10a/0x140 [iwlmvm]
[   22.680477]  ieee80211_recalc_chanctx_min_def+0x1ee/0x340 [mac80211]
[   22.680490]  ieee80211_assign_vif_chanctx+0x21c/0x420 [mac80211]
[   22.680502]  ieee80211_vif_use_channel+0x17b/0x290 [mac80211]
[   22.680514]  ieee80211_prep_channel+0x2be/0x500 [mac80211]
[   22.680524]  ieee80211_prep_connection+0x25f/0x430 [mac80211]
[   22.680536]  ieee80211_mgd_auth+0x19d/0x3d0 [mac80211]
[   22.680548]  ieee80211_auth+0x18/0x20 [mac80211]  Restarting 0x2000000.
[   22.680567]  cfg80211_mlme_auth+0x104/0x210 [cfg80211]
[   22.680579]  nl80211_authenticate+0x284/0x2e0 [cfg80211]
[   22.680582]  genl_family_rcv_msg+0x1b9/0x470
[   22.680584]  ? try_to_wake_up+0x224/0x6a0
[   22.680585]  genl_rcv_msg+0x4c/0xa0
[   22.680587]  ? _cond_resched+0x19/0x30
[   22.680588]  ? genl_family_rcv_msg+0x470/0x470
[   22.680590]  netlink_rcv_skb+0x50/0x120
[   22.680591]  genl_rcv+0x29/0x40
[   22.680592]  netlink_unicast+0x187/0x220
[   22.680593]  netlink_sendmsg+0x222/0x3e0
[   22.680596]  sock_sendmsg+0x65/0x70
[   22.680597]  ____sys_sendmsg+0x212/0x280
[   22.680599]  ___sys_sendmsg+0x88/0xd0
[   22.680600]  ? sock_do_ioctl+0x47/0x140
[   22.680602]  ? __check_object_size+0x4d/0x150
[   22.680605]  ? _copy_to_user+0x2c/0x30
[   22.680606]  ? sock_ioctl+0x24f/0x3c0
[   22.680607]  ? __sys_sendto+0x113/0x190
[   22.680609]  ? __cgroup_bpf_run_filter_setsockopt+0xae/0x2d0
[   22.680611]  ? _cond_resched+0x19/0x30
[   22.680613]  ? aa_sk_perm+0x43/0x170
[   22.680614]  __sys_sendmsg+0x5c/0xa0
[   22.680615]  __x64_sys_sendmsg+0x1f/0x30
[   22.680617]  do_syscall_64+0x57/0x190
[   22.680619]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[   22.680620] RIP: 0033:0x7fe9e8042747
[   22.680622] Code: 64 89 02 48 c7 c0 ff ff ff ff eb bb 0f 1f 80 00 00 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10
[   22.680623] RSP: 002b:00007ffd6dbe3fe8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
[   22.680624] RAX: ffffffffffffffda RBX: 0000558a3dd79700 RCX: 00007fe9e8042747
[   22.680624] RDX: 0000000000000000 RSI: 00007ffd6dbe4020 RDI: 0000000000000006
[   22.680625] RBP: 0000558a3ddcb680 R08: 0000000000000004 R09: 00007fe9e810ab80
[   22.680626] R10: 00007ffd6dbe40f4 R11: 0000000000000246 R12: 0000558a3dd79610
[   22.680626] R13: 00007ffd6dbe4020 R14: 00007ffd6dbe40f4 R15: 0000558a3ddca1b0
[   22.680629] iwlwifi 0000:04:00.0: PHY ctxt cmd error. ret=-5
[   23.196499] iwlwifi 0000:04:00.0: Failed to send MAC context (action:2): -5
[   23.197142] iwlwifi 0000:04:00.0: failed to update MAC 00:e1:8c:77:ed:1d
[   23.198713] iwlwifi 0000:04:00.0: Failed to send MAC context (action:2): -5
[   23.199797] iwlwifi 0000:04:00.0: failed to update MAC 00:e1:8c:77:ed:1d
[   23.200775] wlp4s0: failed to insert STA entry for the AP (error -5)
[   23.200778] iwlwifi 0000:04:00.0: Failed to send MAC context (action:2): -5
[   23.201753] iwlwifi 0000:04:00.0: failed to update MAC 00:e1:8c:77:ed:1d
[   23.203618] iwlwifi 0000:04:00.0: Failed to send quota: -5
[   23.204815] iwlwifi 0000:04:00.0: Failed to send binding (action:3): -5
[   23.206750] iwlwifi 0000:04:00.0: Failed to send MAC context (action:2): -5
[   23.207986] iwlwifi 0000:04:00.0: failed to update MAC 00:e1:8c:77:ed:1d
[   23.209208] iwlwifi 0000:04:00.0: PHY ctxt cmd error. ret=-5
[   23.230555] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   23.362536] iwlwifi 0000:04:00.0: Applying debug destination EXTERNAL_DRAM
[   23.428963] iwlwifi 0000:04:00.0: FW already configured (0) - re-configuring
[   23.559711] wlp4s0: authenticate with [[edited]]
[   23.564136] wlp4s0: send auth to [[edited]] (try 1/3)
[   23.569273] wlp4s0: authenticated
[   23.573418] wlp4s0: associate with [[edited]] (try 1/3)
[   23.575706] wlp4s0: RX AssocResp from [[edited]] (capab=0x431 status=0 aid=1)
[   23.577894] wlp4s0: associated
[   23.651524] IPv6: ADDRCONF(NETDEV_CHANGE): wlp4s0: link becomes ready

Clearly there is an issue with the combination of settings, microcode and hardware that needs to be fixed.

Hardware/firmware

I’m running 5.4.0-89-generic on a Thinkpad T570 with an Intel 8265 / 8275 rev 78 and microcode 36.77d01142.0

lspci -k shows:

04:00.0 Network controller: Intel Corporation Wireless 8265 / 8275 (rev 78)
	Subsystem: Intel Corporation Dual Band Wireless-AC 8265
	Kernel driver in use: iwlwifi
	Kernel modules: iwlwifi

dmesg | grep firmware returns:

[    5.011501] iwlwifi 0000:04:00.0: loaded firmware version 36.77d01142.0 op_mode iwlmvm
[    5.120851] iwlwifi 0000:04:00.0: Allocated 0x00400000 bytes for firmware monitor.

Solution

Reading through forums, one notices this is not uncommon with the Intel iwlwifi modules.

I found a lot of options to handle this, including:

  • Reverting to older microcode by moving the current out of /usr/lib/firmware/ and reverting to an older version. For me this would be going back to v34, then v31 and so on until the issue was gone (not ideal)
  • Going through the upstream and see if newer versions where available upstream (not the case atm)
  • Sending a polite email to linuxwifi@intel.com hoping to get some support (not likely)
  • Get another card (limited to the hw options that Lenovo permits with my default BIOS, and *that* card might also have issues)
  • Changing the module parameters hoping to get improvement.

I opted to go through the last option, and try to limit the amount of changes to what was strictly necessary.

I started by following a recommendation from the Archlinux forum, I created /etc/modprobe.d/iwlwifi.conf (can be any name, as long as it ends in .conf) with the following contents:

options iwlwifi 11n_disable=1 swcrypto=0 bt_coex_active=0 power_save=0
options iwlmvm power_scheme=1 
options iwlwifi d0i3_disable=1 
options iwlwifi uapsd_disable=1 
options iwlwifi lar_disable=1

After a reboot, the issue did not reappear.

However going over dmesg, I found that one of the options (d0i3_disable=1) was not valid, and I set out to reduce the options to the ones (or combination) required to solve the issue.

The current (working) contents of my .conf file:

options iwlwifi 11n_disable=1 swcrypto=0 bt_coex_active=0 power_save=0

Hope this saves someone some time.

pCloud sync issue

I had this crappy issue with with the pCloud Linux (AppImage) client (version linux-x64-prod-v1.9.7).It would get stuck syncing a “Local sync” folder, where Preferences screen as well as the CLI would hang at a certain amount of files and size to be uploaded.


Having no logs to go by (and less than useful technical support on their end), it took me quite a while to find the issue. In the end I found the database where I found some clues as to what was wrong.


The database is called “data.db”, a file in your “~/.pcloud” folder. It is a SQLite database, so install sqlitebrowser to open it, then execute


sqlitebrowser ~/.pcloud/data.db


The “browse data” tab allows you to check the contents of the tables. The “localfolder” table turned out to be what I was looking for. It contains a list of all files that should be synced, with their id, folder, parentfolder, inode …

Contents of the localfolder table.


I noticed that no inode, timestamps or deviceid were given starting at a certain id. That looked interesting. The filename contained an “*” (asterisk) in the filename which doesn’t feel right. I can’t imagine I would have created such a filename intentionally.
So where is this file? The screenshot above shows that it has a folderid of 871638551. Lets search for this id in the most logical table, called “folder”.Using the “Execute SQL” tab we can quickly search for it.

select * from folder where id == 871638551;

and hit CTRL + ENTER.

Result of the SQL query (in the middle)


This returned a row with the name of the file, but a parentfolderid of 288744716. This shows me a row with the folder name that contains the file. You can go up all the way by searching for the parentfolderid of each folder (or write a simple Python script for this), but for me this was enough to show me that the issue was an autogenerated file created by Calibre.


I went online, logged in to my pcloud account, deleted the file, restarted the pcloud client and a couple of minutes later everything was synced. Problem solved.

Finished downloading!

Add warning and tip macros to TiddlyWiki

I am a *very* big fan of TiddlyWiki. I use it to document just about anything I figure out while working on projects, setting up systems, … Anything I would otherwise quickly forget. It makes it easier to add structure to random tidbits of information, and forcing myself to document while I work on something helps to stay focused on a certain goal.

I noticed some of the “official documentation” Tiddlers had options to emphasize tips and (more importantly) warnings, such as these:

While there seems to be an endless list of special tricks one can do with a TiddlyWiki, this was something that seemed really useful so I decided I needed to find out how to recreate them…

Add the macros and stylesheets

In the examples below, replace “Deevee” with any other folder name where you want to gather your own custom macros and stylesheets…

  • Create a new tiddler, name it $:/Deevee/macros
  • Add the tag $:/tags/Macro
  • Past in the following contents:
\define .tip(_) <div class="doc-icon-block"><div class="doc-block-icon">{{$:/core/images/tip}}</div>$_$</div> 
\define .warning(_) <div class="doc-icon-block"><div class="doc-block-icon">{{$:/core/images/warning}}</div>$_$</div>
  • Create another tiddler, name it $:/Deevee/styles
  • add the tag $:/tags/Stylesheet
  • paste in the following contents:
.doc-icon-block {
	border-left: 2px solid <<colour code-border>>;
	margin-left: 3em;
	padding-left: 0.6em;
	position: relative;
}

.doc-block-icon {
	position: absolute;
	left: -3em;
	top: 0.2em;
}

Using the macros

Simply use:

<<.tip “your text”>>

<<.warning “your text”>>

Setting up Visual Studio Code for Python development (on Linux)

The following is a brief guide to reinstalling/setting up Visual Studio Code (VSC) on a new Linux system. The main use is Python development. As such, it is very brief and mostly for my own documentation.

Install VSC

sudo snap install --classic code

Install Python packages

! DO THIS OUTSIDE OF AN ACTIVE VIRTUAL ENVIRONMENT !

  • linting (flake8): python -m pip install pyflakes pycodestyle mccabe flake8
  • Refactoring (rope): python -m pip install rope
  • Formatting (Yapf): python -m pip install yapf
  • Type checking (mypy): python -m pip install -U mypy --user
  • Flake8 Bugbear: python -m pip install flake8-bugbear, then check if installed with flake8 --version (should include flake8-bugbear)
  • Sphinx/RST support: python -m pip install doc8 rstcheck sphinx-autobuild
  • Snooty languageserver: python -m pip install snooty-lextudio

Install and configure plugins

Select interpreter

Add

"python.pythonPath": "/usr/bin/python3",

to $HOME/.config/Code/User/settings.json

Set up linting

List of possible linters and how to configure them

Open user settings and

  • set Python > linting: flake8 path, to C:\Python39\Scripts\flake8.exe
  • Add max-line-length=99 to Python > Linting: Flake8 Args
  • Enable flake8

or add

    "python.linting.flake8Path": "C:\\Python39\\Scripts\\flake8.exe",
    "python.linting.flake8Args": [
        "max-line-length=99"
    ],
    "python.linting.flake8Enabled": true,

to %APPDATA%\Code\User\settings.json (Windows) or $HOME/.config/Code/User/settings.json (Linux)

MyPy:

  • Install package

python -m pip install -U mypy --user

  • Enable
    "python.linting.mypyEnabled": true,
    "python.linting.mypyArgs": [],
    "python.analysis.typeCheckingMode" :"basic",
    "python.linting.mypyPath": "C:\\Users\\dieterv\\AppData\\Roaming\\Python\\Python39\\Scripts\\mypy.exe",

to ~/.config/Code/User/settings.json

more mypy info

Autodocstring

Add the following to your settings.json

"autoDocstring.docstringFormat": "google",
"autoDocstring.guessTypes": true,
"autoDocstring.generateDocstringOnEnter": true,
"autoDocstring.includeExtendedSummary": true,
"autoDocstring.quoteStyle": "\"\"\"",

Home Server – setting up ZFS (revisited)

Finally, after two years of renovations and two children, I am revisiting the idea of a small home server. I don’t expect it to do much:

  • Media server
  • File backup
  • Some docker containers
  • Grafana
  • Possibly pfSense or another firewall

Whenever I’m accessing a remote system (even when using SSH in my internal network) I prefer to start a TMUX session. That way, if I get disconnected (for instance) during the middle of a package upgrade, that process just continues and I can reconnect at a later time without issues (if tmux is not yet installed or you’re not using it yet, I highly recommend reading up on it and taking a bit of time to get used to the basic concepts. I used this quickstart a couple of years ago).

tmux new -s sessionname

Install the required zfs package:

sudo apt update && sudo apt install zfsutils-linux

Then find out which drives you want to use:

sudo fdisk -l

In my case, I wanted to use the two 1.8GB drives (/dev/sdb and /dev/sdc) in a mirror configuration. I don’t have a hundred movies to fill a drive, most space will be taken up by photos and system images.

sudo zpool create mypool mirror /dev/sdb /dev/sdc

Check the pool status to verify that it is as intended:

zpool status

The pool automatically gets mounted on /mypool with root:root as owner. I changed the owner/group to my own user

sudo chown <user>:<user> /mypool/ (replace <user>)

Using MicroPython (PyBoard V1.1) with Visual Studio Code

Warning

This still isn’t working as I think it should. Especially the linting and autocomplete still doesn’t work (leaving only the PyMakr module which works partly, in fact). For example: “import pyb” still does not add autocompletion when typing something like “s = pyb.<CTRL + SPACE>”. Most likely this is because I used a combinations of tools that shouldn’t be used together. Need to spend more time on this…

Intro

I’ve recently started using a PyBoard for a project that I am working on. Writing code in an IDE, saving the files, then manually copying them to the board to test them gets tedious rather quickly. If you’re using Visual Studio Code, there are options to do almost everything from within the IDE itself. Getting things to work as they should took a bit of effort and headscratching. What I needed to do is documented below.
Links to the sources of my information is at the bottom.

Install libraries/addon

  • pip install --upgrade pip --user
  • pip install --upgrade micropy-cli --user
  • pip install micropy-cli[create_stubs]
  • pip install rshell --upgrade
  • To prevent “Source directory /pyboard/stubs does not exist.” after creation open pybwrapper.py, change line 63 from
    pyb_path = f"{self.pyb_root}{_path}"
to:
    pyb_path = f"/flash/{_path}"

and save the file.

  • Inside VSC, install the Pymakr plugin
  • Install node.js (see link below, and reboot afterwards)

Create the stub yourself…

(This did not work properly for me. See below for another option.)

  • Connect the PyBoard over USB
  • Find out the serial port number (represented from here on by comXX)
  • Run
    micropy stubs create comXX

    (replace XX by com port number) -> this takes a couple of minutes

  • the result will be copied to ~/.micropy/stubs (in my case in a sub directory “pyboard-1.13.0”

…Or get them from someone else

I got mine from Josverl on Github. See his read.me for more information as well.

  • Pick a directory that will hold the files. Clone the repo:
    git clone git@github.com:Josverl/micropython-stubs.git
  • create a symlink in your project folder:

    mklink /d all-stubs <directory holding the stubs>
  • create a settings.json file in your project folder containing (change the references to the stubs you need, in the desired order):
{
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": true,
    "python.languageServer": "Microsoft",
    "python.jediEnabled": false,
    "python.autoComplete.extraPaths": [
         "all-stubs/cpython_core",
         "all-stubs/pyboard_1_13_95",
         "all-stubs/mpy_1_13-nightly_frozen/GENERIC",
         "all-stubs/cpython_pyboard"
     ],
     "python.autoComplete.typeshedPaths": [
          "all-stubs/cpython_core",
         "all-stubs/pyboard_1_13_95",
          "all-stubs/mpy_1_13-nightly_frozen/GENERIC",
          "all-stubs/cpython_pyboard"
     ],
     "python.analysis.typeshedPaths": [
          "all-stubs/cpython_core",
          "all-stubs/pyboard_1_13_95",
          "all-stubs/mpy_1_13-nightly_frozen/GENERIC",
         "all-stubs/cpython_pyboard"
    ]
}
  • Copy the .pylintrc file from the sample folder and adapt the init-hook line to reflect the chosen folders (in last step):
[MASTER]
init-hook='import sys;sys.path[1:1] = ["all-stubs/cpython_core", "all-stubs/pyboard_1_13_95", "all-stubs/mpy_1_13-nightly_frozen/GENERIC", "all-stubs/cpython_pyboard",];'
  • Restart VSC:
Developer: Reload Window

Set up your project (in VSC terminal, with project open)

  • To check that your stub (config file for your board) has been installed run
    micropy stubs list 
  • If not, run
    micropy stubs add <path to stub> 

    (where the path is the directory that contains the info.json file.)

  • run
    micropy init <project name>
  • Select what to generate (‘a’ selects all)
  • select which stub to use (the one you just created)
  • A subdirectory will created with <project name> you just specified
  • Open the pymakr.conf file in the subdirectory <project name>. Change
    "address":"192.168.4.1" 

    to your comXX. To do this system wide for Pymakr, open the command palette (CTRL+SHIFT+P) and select/type “Pymakr > Global settings”

  • In the same config file, I had to set “auto_connect”: false to resolve some vague
    "> Failed to connect (Error: Port is not open). Click here to try again." 

    errors when connecting to the board. Setting this to “true” the following behavior: “ignores any ‘address’ setting and automatically connects to the top item in the serial port list”

  • See here for more explanation on the other options

Using the combination

  • To add package dependencies to your project:
    micropy install <PACKAGE_NAMES>
  • Functionality in the Pymakr addon can be used by opening the command palette (CTRL+SHIFT+P) and typing Pymakr. There are options to (dis)connect, run the current file, up/download the whole project, get the FW version,…
  • Note the new terminal “Pymakr Console”:
    Pymakr console
  • And the “Pymakr toolbar”:
    Pymakr toolbar

Shortcuts (from the Pymakr addon info)

ctrl-shift-c : (Re)connect
ctrl-shift-g : Global settings
ctrl-shift-s : Synchronize project
ctrl-shift-r : Run current file
ctrl-shift-enter : Run current Line

References

AEG GHE613CB3 dishwasher error 50 (= Ikea Välgjord)

See the edits below the text for two more possible causes I’ve encountered with this machine, both causing the same error.

 

This dishwasher is also known as AEG ghe613cb3, or Hygienisk/Skinande from Ikea…

 

Our Ikea Välgjord dishwasher stopped working last night. When switched on, it would take a minute or so, then begin beeping (three times, then about two seconds of silence). When opened, the display showed error code 50, and the bottom LED blinked.

The manual shows error codes 10, 20 and 30 but no 50.

I found the needed information on this (Dutch) site. Error 50 might mean that the pump is somehow obstructed, possibly by a shard of a plate or (in my case) a large piece of [insert some unrecognizable piece of food here].

The solution took maybe 15 minutes, possible less than a phone call to customer support would have taken. You need:

  • Torx 20 screwdriver
  • Philips screwdriver
  • Some rags
  • Ideally a shop vac that can be used to get the water out. Otherwise: a sponge…

Steps:

  1. Unplug the dishwasher. Seriously. Didn’t do it. Regretted that. (see below)
  2. Get as much of the water as possible out. Remove the filter from the bottom inside the dishwasher, then drain the water. Shop vac if possible, otherwise enjoy yourself with the sponge.
  3. Remove the wooden front panel: open the dishwasher. On each side of the door you’ll find a small grey plastic cover plate. Pop these off. Open the door about halfway until you can see a bolt through one of the holes. This is a torx 20. Remove these. The bottom of the front panel will come loose, so while you do this, hold the bottom of the panel up. Then slide it upwards to clear it from the dishwasher door. Try not to look at all the grime and dirt.
  4. Under the door, on the bottom front of the dishwasher, remove the four Philips screws. Take off the metal cover.
  5. At the right side you’ll see the pump, rather small. It has two blue wires coming out of a connector on the side. Remember the orientation of the pump.2
  6. The pump can be removed by rotating it and pulling it backwards towards you. If there’s still water in the dishwasher (you probably cannot get everything out), water will wash out into the plastic drain pan. The float at the back will detect a water leak and the pump impeller will begin to rotate even if the dishwasher is switched off.

    The pump that you’re holding in your hand.

    In the tiny space underneath the dishwasher.

    With cables around it.

    So, you really might want to unplug the dishwasher from the start.1

  7. Remove the obstruction.
  8. Reverse the above.
  9. Fill the dishwasher filter hole with water (if you start the dishwasher without water, it will display the same error after a little while).
  10. Try it out.

<EDIT> (20 Jan 2019): I’ve successfully done this twice, but this time, there wasn’t any debris in the pump. I haven’t found any other pieces of food anywhere else. After a couple of tries without finding any obvious cause for the problem, the dishwasher started working again. Since the dishwasher is still within warranty (Ikea gives five years of warranty) and you shouldn’t have to do these kind of “repairs” with a new appliance anyway, we asked for a technician which will come over next week. Maybe he has some tips…
</EDIT>

<EDIT2> (24 March 2019) Completely forgot to follow up on the EDIT above. The technician found a bad seal in the washer motor and replaced it under warranty. He told me that it wasn’t something that happened a lot, but enough for him to have seen it before (as a repair technician).
Two weeks later, the washing machine gave the same error. The second technician (another one) found that one of the hose clamps on reservoir on the side of the machine was badly placed and replaced it. Likely, the machine would leak some water, go into alarm mode, get unplugged, would dry after a couple of hours and work again for a short while.
We’ve had no more issues since then, which is about two months ago.

 

So, in addition to “something in the pump” as below, you might want to check for small amounts/droplets of water under the machine in the plastic sump. It might be as simple as a hose clamp…
</EDIT2>