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.