Possible bug on schematic annotation

Hello everyone, short time Kicad (Version 5.0.2-1, release build) user here :slight_smile:
Want to use this my first post also to thanks to all the developers for creating and mantaining such a great piece of software for free!

Now, briefly, the problem I’m encountering: when annotating a schematic containing the “Opamp_Dual_Generic” symbol, bizzare things happen.
In fact, as an example, if I place on the schematic three instance of “Opamp_Dual_Generic” symbol, go to preferences for each of them and select for the first instance “unit A”, for the second instance “unit B” and for the third instance “unit C”, annotating the schematic cause a mess, because my ordering of the unit get completely changed out, hence I can find myself now with the power pins of the opamp (unit C) in the wrong place!

I want to underline that this doesn’t happen when using the “not generic” opamp symbols (LM358, LM2904,OPA2134 etc etc)

Please, could someone help me to check if this is a bug? Thank you!

I think I can confirm this.
I took 3 intstances of “Opamp_Dual_Generic” and placed them next to each other.
From left to right: A, B and the power pins C on the right.
Then I annotated the schematic and the symbols changed.
The order is now B, C, A

After that I tried to edit U3B to change it back to “Unit A” and I got an “assertion failed”.

ASSERT INFO:
/build/kicad-rFhZT9/kicad-5.0.2+dfsg1/eeschema/sch_edit_frame.cpp(621): assert “m_undoItem != __null” failed in SaveUndoItemInUndoList(): Cannot swap undo item structures. Bad programmer!.

BACKTRACE:
[1] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[2] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[3] wxEvtHandler::TryHereOnly(wxEvent&)
[4] wxEvtHandler::ProcessEventLocally(wxEvent&)
[5] wxEvtHandler::ProcessEvent(wxEvent&)
[6] wxScrollHelperEvtHandler::ProcessEvent(wxEvent&)
[7] wxEvtHandler::SafelyProcessEvent(wxEvent&)
[8] g_closure_invoke
[9] g_signal_emit_valist
[10] g_signal_emit
[11] gtk_propagate_event
[12] gtk_main_do_event
[13] g_main_context_dispatch
[14] g_main_loop_run
[15] gtk_main
[16] wxGUIEventLoop::DoRun()
[17] wxEventLoopBase::Run()
[18] wxAppConsoleBase::MainLoop()
[19] wxEntry(int&, wchar_t**)
[20] __libc_start_main
[21] _start

The KiCad version I have is:

Application: kicad
Version: 5.0.2+dfsg1-1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.64.0 OpenSSL/1.1.1a zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh2/1.8.0 nghttp2/1.36.0 librtmp/2.3
Platform: Linux 4.19.0-2-amd64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
Boost: 1.67.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.62.0
Compiler: GCC 8.2.0 with C++ ABI 1013

Build settings:
USE_WX_GRAPHICS_CONTEXT=OFF
USE_WX_OVERLAY=OFF
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_WXPYTHON=OFF
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON

After this I did a few more tests.
The swapping of the symbols only seems to happen with the Opamp_Dual_Generic, and mostly when the Units A, B, C are directly chosen from the library. When you first place the opamps and then change them to units B and C the bug is not always triggered.

After more testing I could not get this behaviour triggered with other dual opamps, but with Opamp_Quad_Generic the symbols (sometimes?) also get swapped.
I first drew tye symbols A, B, C, D, E from left to right and then annotated.
It looks now like:

The order in which the symbols get mixed up also changes.
Again, I drew A,B,C,D,E from left to right and annotated:


Then I try to change the power part of the quad_generic, but the most left (which was orignially the power “Unit E” but had “U9A” as name to “U9C” and again I had an “assertion Failed”:

ASSERT INFO:
/build/kicad-rFhZT9/kicad-5.0.2+dfsg1/eeschema/sch_edit_frame.cpp(621): assert “m_undoItem != __null” failed in SaveUndoItemInUndoList(): Cannot swap undo item structures. Bad programmer!.

BACKTRACE:
[1] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[2] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[3] wxEvtHandler::TryHereOnly(wxEvent&)
[4] wxEvtHandler::ProcessEventLocally(wxEvent&)
[5] wxEvtHandler::ProcessEvent(wxEvent&)
[6] wxScrollHelperEvtHandler::ProcessEvent(wxEvent&)
[7] wxEvtHandler::SafelyProcessEvent(wxEvent&)
[8] g_closure_invoke
[9] g_signal_emit_valist
[10] g_signal_emit
[11] gtk_propagate_event
[12] gtk_main_do_event
[13] g_main_context_dispatch
[14] g_main_loop_run
[15] gtk_main
[16] wxGUIEventLoop::DoRun()
[17] wxEventLoopBase::Run()
[18] wxAppConsoleBase::MainLoop()
[19] wxEntry(int&, wchar_t**)
[20] __libc_start_main
[21] _start

Bad Programmer! indeed :sunglasses:

What options are you using for the annotation? Take a screenshot and post.

Just did it again, (and again mixed up).
1). Open existing schematic.
2). Add opamp A, B, C.
3). Click “annotate button” in button bar.
4). Click “[Annotate]” button on “Annotate Schematic” popup. (Default options, no changes)
5). Confirm stuff is mixed up again.
6). Click “Annotate button” again and made the screenshot below.

I almost thought myself silly when I looked at the “Sort components by Y position”.
Did annotation for U4, and units A, B, C of the TL072 did not get mixed when vertical position differs:
Then drew 3 more TL072 symbols for U5 and they also did not get mixed during annotation:

After that I did a restart of KiCad and did the same ( A, B, C from left to right) with “Opamp_Dual_Generic”.

First drew and annotated U2 and A, B, C and the units got swapped.
Then I did U4 and units A, B, C did not get swapped during the annotation.

After another annotation cycle for U5 “Opamp_Dual_Generic” seems to get sorted in vertical direction:
image
Then I looked back at my first screenshot in this thread and A,B,C is also sorted vertically. Same with both screenshots of “Opamp_Quad_Generic”.


I’m just guessing here, but could it be that the “assertion failed” has anything to do with (maybe) all units being on the same Y-coordinate and this triggers another bug?

Hi @paulvdh- This bug should be fixed in V5.1rc1. Would you be able to test a nightly build?

There is an option to not swap units. The annotator does not seem to understand that the power unit is not interchangeable

1 Like

Symbols that have a separate power unit must have “all units are not interchangeable” selected. This ensures that the annotation algorithm does not try to change the assigned units for this symbol. (Especially useful if you want to allow it in general.)

If this symbol is from the official library then it is a bug and should at least be reported.

2 Likes

@Rene_Poschl That’s it! In the official library named “Device”, the symbols “Opamp_Dual_Generic” and “Opamp_Quad_Generic” DO NOT HAVE the option “all units are not interchangeable” enabled.

Saving those symbols in a new user library and then enabling that option for both solves the problem.

So, I guess we can say that we can consider this as a little bug :slight_smile:

Thank you

2 Likes

Could you please report it over at github? https://github.com/KiCad/kicad-symbols/issues

Question on a related subject.

Does Kicad have an option where the gate selection (or in this case the amplifier) can be swapped in the PCB editor?

When I was working with an outside design house they could make these swaps if the layout would benefit.

John

There is no native support, but I’ve written an action plugin which acomplishes this.

HI,

Thank you. I don’t need it right now (already finished this board) but will need in the future :slight_smile:

Looks like a lot of work went into it … thanks for sharing.

John

Done!
https://github.com/KiCad/kicad-symbols/issues/1554

1 Like

A more general bug is Is the simple on/off switch for symbol swapping.
Even the ubiquitous 74xx has gotten separate symbols for the power pins and I guess there wil not be many swappable symbols left in all the libraries.

In a program I used long ago this was solved by specifying the pin numbers as a list of CSV values. The outputs of the 4 units of a TL074 would then be numbered:

1, 7, 8, 14

Edit: I assumed some solution for this would already be on the roadmap, that’s why I did not make a fuss about it earlier.

Planned for the new file format that will come with v6

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.