Wednesday, May 11, 2022

STM32F7, LWIP, FreeRTOS Error stopping on configASSERT( pxQueue->uxItemSize == 0 );

There is an unclear bug spotted recently in STM32F7 with FreeRTOS v2 and LWIP (ver. 2.1) library.

After a moment of using ethernet socket data stream soft hangs at this line: 

configASSERT( pxQueue->uxItemSize == 0 );

It seems related to semaphore/mutex internal code issue. Could not find chance to dig too deep into it, but this post gave me a good hint:

https://forums.freertos.org/t/xsemaphoretake-function-looping-at-configassert-pxqueue-uxitemsize-0/8116 

I made the similar approach and made semaphore statically defined:

osSemaphoreId Netif_LinkSemaphore = NULL;

in the same lwip.c file.

So far it seemed to help with above problem.

Regarding other different issues with STM32 ethernet communication there is a nice compilation which might help us all:

https://community.st.com/s/question/0D50X0000BOtfhnSQB/how-to-make-ethernet-and-lwip-working-on-stm32




Thursday, March 10, 2022

Useful links for CANopen in embedded platforms

    Here are useful links to resources and information on CANopen embedded programming in general but especially on STM32 microcontrollers.

CANopen Node project   https://github.com/canopennode

CANopen Node code issues https://github.com/CANopenNode/CANopenNode/issues

CANopen stack on embedded devices https://github.com/embedded-office/canopen-stack

CANopen Node supported devices https://github.com/CANopenNode/CANopenNode/blob/master/doc/deviceSupport.md

CANopen Node on Linux https://github.com/CANopenNode/CANopenLinux

CANopen Node example code https://github.com/CANopenNode/CANopenNode/blob/v1.0/example/main.c

CANopen Node Tutorial and testing https://github.com/CANopenNode/CANopenDemo

CANopen Node port on STM32 https://github.com/w1ne/CANOpenNode-CubeMX-HAL

CANopen Node on STM32 https://github.com/CANopenNode/CanOpenSTM32

CANopen application layer poster https://www.can-cia.org/fileadmin/resources/documents/brochures/co_poster.pdf

CANopen for Python https://github.com/christiansandberg/canopen

CANopen NOde Object Distionary editor https://github.com/CANopenNode/CANopenEditor

CANopen quick reference sheet https://www.kollmorgen.com/sites/default/files/public_downloads/S300_S600_S700_CAN%20Protocol%20Quick%20Reference.pdf

CANopen for Python documentation https://canopen.readthedocs.io/en/latest/index.html

CANopen node documentation https://canopennode.github.io/CANopenSocket/index.html

CANopen node discussion on SourceForge (abandoned) https://sourceforge.net/p/canopennode/discussion/

CANopen PDO example https://github.com/CANopenNode/CANopenDemo/blob/master/tutorial/PDO.md

CANopen on Wikipedia https://en.wikipedia.org/wiki/CANopen

CANopen hands-on tutorial slides https://os.mbed.com/media/uploads/sam_grove/canopenhothandouts.pdf

CANopen Nanotec online manual https://en.nanotec.com/products/manual/PD4E_CANopen_EN/bus%2Fcan%2Fcan_stack.html

CANopen Node random project Microchip source code http://www.laukutikls.lv/sites/laukutikls.lv/files/raksti/20_pielikums_ronin.pdf

The Basic of CANopen white paper https://www.ni.com/en-us/innovations/white-papers/13/the-basics-of-canopen.html

CAN bit time calculator http://www.bittiming.can-wiki.info/

CANopen basic explanation on CANFestival basis (RUS) http://we.easyelectronics.ru/STM32/can-canopen-canfestival-stm32-chast-pervaya.html

CANopen practical explanation (RUS) https://i-flashdrive.ru/raznoe/canopen-protokol-obzor-protokola-canopen-arm.html#PDO

CANopen explanation (RUS) https://www.rlocman.ru/review/article.html?di=147763

CANopen explanation (RUS) https://www.rlocman.ru/review/article.html?di=147764

Wednesday, January 12, 2022

Arduino Nano and MCP2515 bringup problem

    When using examples from internet like this popular for example: https://github.com/autowp/arduino-mcp2515 make sure you check your MCP2515 adapter board's hardware. Author of library assumes that MCP2515 are connected with 16MHz clock, and example script CAN_read initialize connection with 16 MHz crystal. In case when your board comes with different crystal remember to change code accordingly.

In my case it was needed

mcp2515.setBitrate(CAN_125KBPS, MCP_8MHZ);

 instead of just:

mcp2515.setBitrate(CAN_125KBPS);

My noname adapter coming from depths of Asia looks similar to this:

For connection to Arduino Nano you can follow this guide:



Monday, December 6, 2021

USB 3 controller error: Windows cannot start this hardware device because its configuration information (in the registry) is incomplete or damaged. (Code 19).

    In case of situation when your computer USB's are not working anymore. Check your Computer Management and in section Device Manager look for USB section and yellow exclamation sign. If you see under properties message: "Windows cannot start this hardware device because its configuration information (in the registry) is incomplete or damaged. (Code 19).", than follow this link and follow steps in accepted answer regarding modification of registry. It helped for me and saved a lot of time otherwise I had to run computer repair installation. None other options like roll back drivers, or installing manufacturer drivers did not work out as they are windows system drivers.

I guess that happened because I was tinkering different around Microchip USB devices which support package somehow messed up some settings in USB enumeration or something similar. After registry edit and following reboot all connected USB devices searched for drivers and now everything works again.

My case was related to Intel USB 3.0 hub, I have seen other devices which can cause similar error message, but than registry class code will be different. This above recipe can help in case of USB hub problems.

Saturday, September 5, 2020

Office 2013 and Office 2016 Outlook error - An unexpected error has occured

     Recently several computers constantly issued an error messages when starting Outlook application. Message text was "An unexpected error has occurred." And after accepting an error with OK button, Outlook app just closed. Loop continues forever, you just could not use Outlook at all. Lot of attempts was made to resolve this issue: starting Outlook in safe mode, Office installation repair, full reinstall. That did not help.

Both computers were Windows 10, one has Microsoft Office Home and Business 2016, other has Office version 2013.

The solution in this case for both computers was, creating new Windows users and as as result of course creating new profile structure. Than you have to copy all important files to this new profile back (documents, pictures, bookmarks etc.). Good thing is that most likely when you face this Outlook issue is fresh installed system and you don't have many custom files on computer.

OK, and what was important in my case, you don't just create any user profile, but you try to avoid Unicode characters in profile name (just use Latin ASCII character keyboard set). In my case originally were letters 'ā' and 'ū' in user names, which I changed to 'a' and 'u'.

Anyway it is quite strange that Microsoft in practice still is not supporting Unicode in their software. And looks like it is still better to stay away from "strange" characters in profile folder names. It was English/US versions of both Windows and Office software in my case, might be that localized software versions lacks this problem. Hope this info can help somebody.


Wednesday, June 10, 2020

Thursday, November 21, 2019

How to connect Canon CanoScan Lide 50 to Windows 10 x64 computer

As Canon has decided to obsolete old scanners among them are also CanoScan Lide 50 they are not providing drivers for Windows 10 anymore.
I managed to Google it and find unofficial drivers from here https://www.webwhitenoise.com/item/2009/05/canon-canoscan-lide-50-x64-drivers/
File name is called DNA Canon  LiDE50 x64 Driver.7z

After installation story is yet not ended because you also need an app to use scanner. Original Canon CanoScan Toolbox was not working, it stopped with error "Cannot select TWAIN source". I tried several versions and failed to make them running. Free app called Scan which is available from Microsoft Store also is not working. Finally I managed to find NAPS2 software, and that works like a charm. You can download it from here https://www.naps2.com/

If you have difficulties with steps above you might need to enable Windows Test mode. Here is how it can be enabled/disabled https://www.howtogeek.com/167723/how-to-disable-driver-signature-verification-on-64-bit-windows-8.1-so-that-you-can-install-unsigned-drivers/ 
In my case folder to add to PATH was C:\Windows\twain_32\CNQL60

 

Monday, September 9, 2019

CDT Bad character sequence encountered

Today Atollic TrueStudio for STM32 when compiling yells about error:
Bad character sequence encountered: 

Reason was next to #define name in another header file was a an apostrophe symbol. Something like 
#define SPEED' 100 and on laptop screen it was hard to see it because of dust particle on my screen exactly at that place where. That was a funny. Cannot decide what to do, to clean a laptop screen or connect external monitor. Hmm. Ok. Starting looking for cables.

Monday, June 17, 2019

iRobot Roomba charging error 3

This post is confirmation that fix for charging error No 3 for iRobot Roomba 555 that is shown in this Youtube video

really works.
After struggling with bad accumulator I bought a replacement from Ebay. Cleaner with bad battery worked maximum 10 minutes. New battery was good for a couple of cleaning sessions, but then after a longer idle time I got the error above. It was very unpleasant situation, because just bought a new accumulator and another error came out. Atfer short googling I decided to proceed with solution from Youtube. Disassembled my Roomba, but did not see any corrosion. Just small amount of yellow stains. Almost invisible. Despite of that I decided to clean the area with alcohol. And it helped. Error disappeared. Apparently there are located some sensitive feedback circuit for battery voltage or current detection.
Here you can see some tips on disassembling iRobot Roomba


Thursday, May 30, 2019

HP AC Power Adapter 0957-2242 repair

Had a broken HP-Photosmart printer power supply. Its parameters are input 100-240VAC 50/60Hz and output 32VDC 625mA. Condition  - not working. My first steps were measuring output voltage on DC cable on pins 1 and 2. No output. Green LED is not on also. Checked AC cable for continuity. AC cable was OK too.
Next steps apparently was to suspect inside electronics. I started to open supply enclosure hoping on easy fix. You need to unscrew hex bolt from bottom. Enclosure is holding on some clips what I did not know at that moment and made unnecessary damage to plastics. Later had to use an epoxy glue when assembling back.
Shortly problem were short diodes (1N4007) in diode bridge, which led to burnt fuse. It can easily be checked with multimeter in resistance/diode mode. Diodes were in short, and fuse in open.

In picture below you can see bad components.

At the moment I had no exact parts available, so I replaced 1N4007 with 1N5408 and fuse with round one (same rating F4A) with piece of wire soldered to one of outputs to reach holes in PCB.

Here is how board looks with replaced alternative components.

Power supply is functional again. Hard to say to what was the main reason for broken diodes. Maybe some voltage or current spike while turning on...

Thursday, April 18, 2019

Digital DVB-T tuner ETR-500CHD repair

Symptoms were following - after turning on tuner shows "Initializing..." on grey background on TV screen. After a moment screen goes black and no picture anymore. Next idea after checking power supply output voltages inside of device was trying to update firmware. Unfortunately that is quite an old model and I was not able to find an firmware file. But I was lucky trying contacting support at https://www.elpa.lt/ I described the problem and after requesting serial number of my tuner they sent me "dh-update.ud" file. Flash needs to be formatted (I chose FAT16 to be sure), copied update file to it. And than with USB Flash drive connected turned on the tuner. And magic happened, LED indicator started to blink indicated different update stages. It took maybe 3 minutes and now tuner is alive again.



Tuesday, March 19, 2019

Repair of a remote

Recently my sibling gave me DVB-T set top box describing problem - probably remote is bad. Receiver itself was functioning OK, using face panel buttons, so I decided to start investigate remote.
Checked batteries -> OK, looked on IR led through phone camera kind of blinking but little bit strange. Checked  remote internals visually, kind of OK. Resonator looked little bit suspicious, it was not fixed to PCB, but still connected and soldered well. I have seen lot of times badly looking resonators but I have never needed to replace one. Thought this is probably same also this time. After checking everything all is in place, remote still not working. At this moment one could just give a try and replace resonator, but I wanted to make sure. I have no scope available, but than I remembered I have multi-meter with frequency measurement option. I measured resonator outputs while pressing remote key. And noticed strange behavior, frequency value started with 98 KHz, and than fluctuated up to 1MHz and again down below even those 98 KHz. It does not look normal for resonator which should be running around 455 KHz according to figures on component package. Originally there was green rectangular component, letters PG on top and NSB 455J. Not clear is it a manufacturer's quality issue or result of badly dropped remote. Anyway I was lucky that I had a spare part in my component storage, replaced and that was it. Remote is functional again.


Sunday, July 8, 2018

TomTom Start 20 trouble

I am a lucky owner of navigation system TomTom Start 20. It works quite good, must say and I am satisfied in general. After a while of using decide to update maps and software as this is included as a lifetime service.
And than I got in 3 hour fight to connect the device to PC. I reinstalled software, installed/reinstalled drivers. Tested on 2 computers with 4 different USB cables. No luck. And than by accident saw a message on navigator screen that I must use original cable when connecting to computer because other cables might not work. And yes, found an original cable connected and it magically started to work.
Don't know yet how this TomTom cable is different (maybe data lines swapped ?), but lesson here is to read messages and manuals which are provided by manufacturer. Sometimes it can save you a lot of time. ☺️

Monday, July 11, 2016

Office Professional 2003 installation

One day there was need to reinstall old home laptop. It is still working acceptable, and I also decided to put into it a new SSD drive. So why not reinstalling? But story is not about that actually. I have official Office 2003 version bought for that particular device. But unfortunately held into closet for 8 years CD-ROM was not able to start installation because of corrupted files. Visually there was no any indications that CD-ROM is bad but still it was not working on any of several computers.
Contacted Microsoft support. They politely told me that that version is not supported anymore. Actually it was not easy to find an official original installation ISO file. I spent a good amount of time. But luckily I ended at this site.
I downloaded needed ISO. Installed. Activated. So far works OK. Good.

Sunday, December 13, 2015

Dell Vostro 3350 problems upgrading to Windows 10

To get to Windows 10 appeared not an easy and straightforward task on Dell laptop. I chose upgrading from Windows 8.1 but not making a clean install. Can not comment on fresh install but upgrading made problems.
Process started as usually. Double clicking Windows 10 upgrading icon at the desktop clock. Everything went smoothly but during the process close to completing laptop screen went black. Computer was responding and it can be decided by looking on HDD light blinking and also Caps Lock light toggling. Thanks to googling I found recipe that helped.
  • First what you must do is connect external monitor to VGA output socket. You must be able to see login screen. Log in yourself.
  • Than connect to Internet and go to Dell.com and download latest BIOS update for your machine. I updated to A09, but when writing this also found that A10 is available. I suppose this is not critical, just use latest one.
After restart you should see picture on both screens.

Both Windows are 64 bit versions.
Before I was testing different drivers for Intel HD Graphics 3000, newest one and some older, but what actually helped was this BIOS update.
You can also get picture on laptop's screen manually selecting Basic Graphics Drivers, but this is not good solution because you can't use maximum resolution also other features like external monitor connection etc are disabled.

Tuesday, November 10, 2015

CRC calculation in C

Here are some useful Internet resources when you have to deal with CRC calculation and checking. I found them handy and use occasionally. Some are online calculators, some gives also technical descriptions.
Below is some real working C source code. Borrowed from here!
It is tested and working. It calculates CRC CCITT16 with starting value 0xFFFF. It might be not as fast as table based CRC calculations, but occupies less RAM and code space which sometimes is essential for embedded systems.


#define POLY 0x1021

unsigned char i;
unsigned int crc = 0xFFFF;

while (wLength--) {
    wCrc ^= *(unsigned char *)pData++ << 8;
    for (i=0; i < 8; i++)
        wCrc = wCrc & 0x8000 ? (wCrc << 1) ^ POLY : wCrc << 1;
}
return wCrc & 0xffff;

Friday, November 6, 2015

uVision UDAS debugger connection problem

Recently I was getting strange error when trying to debug sample software on Infineon XC800 Starter Kit. Previously it was all ok, but now I got error messages in uVision output window:

Searching for DAS Server 'UDAS'...
DAS Server 'UDAS' is installed.
DAS Server 'UDAS' is not started yet. Trying to start it now...
DAS Server 'UDAS' has been started successfully.
Warning: Unknown JTAG ID=00000000. Assuming an XC866-4FR device with 16K flash

 I struggled for a while with the same problem but without success. Finally decided to search Internet and found some guidance here. I decided to switch mini-USB cable and problem disappeared immediately. Apparently I was using some random cheap low quality cable this time. Took another good thick cable and everything was fine.

Some lesson to learn. Always use good cables and check Internet after a moment if you are not succeeding to resolve problem soon.

Wednesday, July 8, 2015

Repair of Samsung laptop AC adapter model CPA09-004A

Sister has got a Samsung RC520 laptop. And this laptop power supply has got some functionality problems since bought. From time to time it stopped charging laptop and green LED light in adapter case went off. Than it was discovered that pulling off mains plug and plugging back in socket resolves issue. But unfortunately problem got more sever and after a while this procedure above did not help anymore. As the warranty period was over I decided to try to repair it.

AC adapter model name is CPA09-004A and it is made by Chicony Power Technology company. While opening adapter plastic case with knife I was thinking about possible problems what could made such fault symptoms. I was suspecting some loose soldering connection or something else but easy to fix. After opening and removing shields and rubbing away glue spots first thing I noticed was missing solder on one side of zero ohm resistor.

Red arrow shows resistor pad which is missing solder
It is always good to start electronic equipment repair with close look and inspection of device. It can save a lot of time.
So this situation with partly soldered part of course was suspicious already. After closer look it shows that resistor is series connected with optocoupler. And it explains device fault symptoms. When resistor looses connection than PWM driver are not getting feedback signal and shuts itself down. Removing and reapplying mains voltage restarts driver IC.
Than I properly soldered the resistor and connected the power supply to mains. And problem was gone of course. It can be seen also by looking on green LED which was steady and bright.
I don't know how likely is that somebody of you can meet the exact same problem on your AC adapter, but it tells something about Chicony manufacturing quality control. If you have the same product and it needs repair start with close visual inspection and look for loose connections, solder joints and similar easy things first.
And remember to be cautious when connecting power supply PCB to mains voltage without enclosure, because it is dangerous. If you are not sure what are you doing better leave repair to electronics repair service professionals.

Wednesday, May 27, 2015

Favorite IDE font

Today I selected new favorite font for my current IDE. It is called Consolas. It is quite nice good looking, monospaced and also clearly visible on screen. I use it of size 11. I have used it half a day and so far I am happy with it.

Monday, May 11, 2015

KEIL uVision 5 error: LOADED APPLICATION DOES NOT MATCH ROM CONTENT!

It took me several minutes to realize how to resolve this problem when you try to load your application into MCU and debug. It happens when you make some changes in the code, build it and after that start to debug. Apparently happens that situation that build in your computer is different from that one that is in the MCU flash memory as the following message tell us.

Error message is following:
LOADED APPLICATION DOES NOT MATCH ROM CONTENT!
Address:nnnn
Value=nxnn
Expected=nxnn
Please download the application into ROM.

I did not realize what is the problem immediately and googling this lead  to some wrong hints about missing header files. Actually it is very easy to make this problem go away. In the Keil uVision go to menu Flash -> Configure Flash Tools -> in the "Utilities" tab enable check box "Update target before Debugging"