If nothing else this might be a good cautionary tale to others, but maybe we can figure out some kind of workflow while we wait for the 6.0 release towards the end of the year.
I’m running KiCad 5.1.9 on Linux Mint 20, x86-64.
I have a hierarchical design (root sheet + two sheets inserted as modules). As you can imagine, the PCB layout, despite my best efforts, has the (usual) complete jumble of reference designators as compared to the placement coordinates on the board. In other packages, I would have done a back-annotation using the built in utilities, but given that in KiCad this feature is only in the nightly builds I decided to try and force the issue manually.
The process I chose was by dumping the component position file as a csv (File -> Fabrication Outputs -> Footprint Position File), bringing this into a spreadsheet, and sorting by refdes. By copying the refdes column, and adding two columns immediately to the right of that, “schnew” and “pcbnew”, I had a way to crudely track the refdes updates, and away I went updating the fields in each column as I updated the refdes in both the schematic and pcb, using the spreadsheet to ensure they matched.
After I was done, I tested the work by generating a netlist from the schematic and loading it into the board design. No errors, but there were some copper pours that were now flagged with ratsnest lines because the net assignments had changed. Re-assigning those fixed that, and the layout and schematic were now apparently in sync, with usable test point and component refdes numbering on the PCB, so I saved my files, closed KiCad and carried on with other things.
Then I opened KiCad and my pcb again a little while later, and all the refdes changes were gone. Interestingly, all the other changes, like refdes repositioning, character sizing, rotation, etc. were all still intact. Even more interestingly, the expected problem with copper pours did not reappear, even though, based on the net names that are shown, they should not be connecting.
Additionally, the schematic now fails to open with the following error message:
Error loading schematic files “[path-to-schematic]/schematic-filename.sch”.
expected single character token in input/source
line 216, offset 29
So I have three questions, to start:
- What happened to the refdes changes in PcbNew? There were no error messages, and it seemed happy enough to save and close the file with nothing untoward spewed to the kicad console.
- I was able to, once, get the schematic to open, by renaming the pcb so the new one had an extension of .kicad_pcb-wtf so I could rename .kicad_pcb-bak to .kicad_pcb. Again, no error messages, but now the schematic no longer opens, regardless of file renaming shenanigans. How is this possible?
- While I have backups, some of the other changes I’ve made to the files made them far more readable and usable, so I’m loathe to give up on the files. Are there any suggestions for recovery of at least of the schematic, even if the parts are no longer in sync? I’m ok with extreme measures such as blowing away all of the parts on the pcb, but leaving the copper on the board, and then importing the netlist and replacing the parts to suit the copper traces and pours…
There is no .cmp file in the directory, nor was one intentionally generated for this design.
There’s a whole bunch of other questions I have, but I think we should start there, before heading down the rabbit hole of how these files compare to database files, manipulating primary keys, etc.
Thanks in advance,