Sunday, 2021-09-26

*** ghostmansd-pc <ghostmansd-pc!> has left #libre-soc12:11
ghostmansdPlease, let me know if you have ideas how to prefix pyfnwriter-generated calls; I'd like the generator to be as restrictive as possible, exactly like I did with "fixed" helpers. That is, I'd like to avoid prefixing everything I meet with "self." prefix.12:14
ghostmansdHowever, for now this seems to be the simplest option.12:15
ghostmansdEspecially given that we tend to invoke pywriter/pyfnwriter code manually, so supplying a new pywriter input / pyfnwriter output is kinda verbose.12:16
lkclv. tired12:50
lkcldo best you can12:50
lkcladd DPD_TO_BCD etc to list which puts "self." in front12:53
lkclmake pyfnwriter generate class12:53
lkclinherit class in caller.py12:53
lkcllike pywriter all.py12:54
ghostmansd[m]lkcl: that's OK, take your time and have a rest! I'll handle it14:25
ghostmansdfor blech in ['NIA', 'end_loop']15:49
ghostmansdcouldn't resist to laugh :-D15:49
ghostmansdif blech in pycode:  # HACK - TODO fix15:50
ghostmansdlkcl, I must stress: I _really_ like the parser15:50
ghostmansdeach encounter is an entertainment15:50
*** kylel1 is now known as kylel16:10
lkclwell, laughing at how awful it is is better than crying17:14
ghostmansdI didn't mean awful18:41
ghostmansdI saw lots of awful code18:41
ghostmansdthis one isn't as awful as you might think18:41
Las[m]So I'm trying to program my ECP5 with Libre-SOC, and I get this error:
Las[m]what does this mean?19:36
Las[m]Which error is fatal?19:37
Las[m]I'm not even sure what program it is that is failing specifically.19:47
lkclnotice how the "identifier" is mutlipled by 2?19:54
lkclintsead of 0x111NNNN19:54
lkclthat's a bug in either openocd or in the FT232 firmware to which openocd is connecting on the VERSA_ECP519:54
lkclit hasn't even got to the point of uploading the bitstream, at all19:55
lkcltry the debian/10 version of openocd19:56
lkclopenocd --version19:56
lkclOpen On-Chip Debugger 0.10.0+dev-00198-g35eed36f (2018-11-17-00:51)19:56
lkclLicensed under GNU GPL v219:56
lkclFor bug reports, read19:56
Las[m]Thanks, I'll try that.20:21
cesarThe unexpected device found in the JTAG chain at line 68 seems suspicious.20:35
Las[m]I switched to openocd 0.10 and the error says that it read 0x44810c01 now...20:36
Las[m]Why is backward compatibility not a thing for FPGA tooling20:36
Las[m]Does openocd depend on prjtrellis or similar?20:37
cesarDid you power off the board before retrying?20:38
Las[m]No, I didn't20:39
Las[m]Do I need to do that?20:39
Las[m]I am very new to FPGAs20:39
cesarJTAG is based on a shift-register. Maybe something was left from your earlier attempt.20:41
Las[m]I don't think it's using JTAG; I haven't connected anything to the JTAG interface20:41
cesarThe USB cable leads to a USB-to-JTAG converter on the board itself.20:42
cesarAnyway, to see if the error is repeatable and reproducible, better to retry from the beginning, with the board off.20:44
Las[m]Will do, I assume I just pull the plug out?20:46
cesarI suppose so. Better disconnect the USB as well, and connect it again AFTER turning it on.20:49
cesarlkcl: Did you by any chance changed the jumpers on J50, on your board, to remove an "ispCLOCK" device from the scan chain? If so, Las should do the same.20:57
cesarSee J50 settings on, pg 19.20:58
lkclJTAG is a Finite State Machine21:03
lkclalso, FT232 / FT2232 USB-UARTs are susceptible to "Ground Loops"21:03
lkclif you are operating without a proper earthed Power Supply (very common in Europe) by only using a 2-pin power block, or if using a laptop whose PSU does not have an earth pin, you get fluctuations in power21:04
lkcland USB-UARTs only operate with "pull-down" (floating 3.3v)21:05
lkclthey're very cheap21:05
lkclso you could easily be "spiking" the USB-UART and not know it21:05
lkclbecause the VERSA_ECP5 is running from a 12v PSU21:06
lkcland there's a loop which goes:21:06
lkcl* USB earth line21:06
lkcl* into VERSA ECP521:06
lkcl* down the 12v PSU21:06
lkcl* through the power socket21:06
lkcl* through the mains earth21:06
lkcl* through to the Laptop PSU21:07
lkcl* through to the DC supply of the laptop PSU21:07
lkcl* into the PCB of the laptop21:07
lkcl* back out to the USB GND earth line21:07
lkclall of which is totally susceptible to 110/240 volt AC Mains "hum"21:07
lkcland just general resistance21:07
lkclyou can *MAYBE* "solve" this problem by disconnecting the laptop from its PSU21:08
Las[m]so could this becausing it?21:08
lkclget a powered USB Hub21:08
lkcland connect the USB-UART into the hub21:08
lkclif you constantly get errors (that report of what "ID" is) is completely different each time, it's likely21:09
lkclcesar: i honestly can't remember21:09
lkcli have pins 1-2 with a jumper21:10
cesarCould you look at J50 on your board? It should be near the FTDI chip.21:10
lkcland 3-5 connected with another jumper21:10
Las[m]It doesn't seem to be completely different every time.21:10
lkcl6-4 are NOT connected21:11
lkclok that's a good sign21:11
lkclcheck J50.21:11
cesarLas: Could you check your J50 to see if it matches?21:11
Las[m]Restarting, it says "READ = 0x2224086" again21:11
Las[m]I assume it's written on the board, where that is?21:11
lkclbtw, you have the PCB on a wooden desk?21:11
Las[m]I do21:11
Las[m]It's on the bubblwrapping itcame with though21:12
Las[m]Between the wood and it21:12
lkclnot "a piece of static-ridden carpet"21:12
lkclabout 50 mm to the left of the USB connector21:12
lkclright sorry21:12
lkclUSB connector21:12
lkcl25 mm to the right is the FT2322 ASIC (48 QFP i think)21:13
lkcl25 mm further to the right is J50.  look closely at the PCB "silk screen" (white writing)21:13
lkclpins 1 2 5 and 6 are all marked, writing appx 2mm high21:13
Las[m]Not sure how this will look on the IRC side21:14
* Las[m] uploaded an image: (3061KiB) < >21:14
Las[m]I sent a picture of it21:14
lkclyeah please don't use IRC for uploading of images21:14
lkcljust because matrix can do it doesn't mean IRC can21:14
Las[m]What do you see? Nothing?21:14
lkcl Las[m] uploaded an image: (3061KiB) < >21:14
lkcl<Las[m]> I sent a picture of it21:14
Las[m]Oh that's nice21:15
lkclturn through 90 degrees21:15
lkcl50 mm in from the USB connector21:15
lkclin writing 2mm high, look for white writing "J50"21:15
lkcldisconnect all power21:16
lkcldisconnect all cables21:16
lkclmake absolutely certain there is no power21:16
lkclDO NOT touch the PCB itself21:16
lkclONLY handle it by the edges21:16
lkcland certainly do not touch the gold connector with your fingers21:16
lkcl(the PCIe connector)21:16
Las[m]I feel blind21:17
Las[m]oh I can see jtag act21:18
Las[m]not j5021:18
cesarFrom the photo, Las seems to have J50 in the factory condition: 1-2, 3-4, 5-6.21:18
lkclcesar, ah good, you were able to make it out21:19
lkclthis is very easy, Las, but you need to stop thinking in terms of "it's a monolithic object / black box, it Should Just Work"21:19
lkcli'm feeling your hesitance, let's walk you through it21:20
lkclif you have a magnifying glass or a bright light (or both) it will help21:21
lkclnow re-read what i wrote about the jumpers... 1 sec...21:21
Las[m]I was using a bright light, but didn't notice it because it was shadowing it21:21
Las[m]should have thought about that21:21
lkclremove the jumper between pin 6 and 4.  put it back "hanging" on either pin 6 or pin 4 so you do not lose it21:22
lkcl(one of the worst bloody things in the world, having $200-$1000 equipment that you can't use because of a missing $0.02 jumper)21:22
Las[m]it seems to be that the jumper is between 6 and 521:23
Las[m]3-4 and 1-221:23
lkclurrr lovely21:23
lkclturn them round so they're in the configuration i described21:24
Las[m]Should this fix it?21:25
lkclbut do NOT power up yet21:26
lkcli am just checking the schematics for the ECP521:26
lkclwhich you should also check for yourself21:26
lkclmistakes are costly with electronics21:27
Las[m]I'll have to find them first21:27
Las[m]I don't think I got one in the package21:27
lkclsee page 19 of that PDF21:27
lkclturn it clockwise through 90 degrees21:28
lkclthen zoom in on Quadrant 1-C21:29
lkcl(or, half-way between 1-C and 1-D)21:29
lkcl1-C and 1-B sorry21:29
Las[m]Thanks, found it myself a few moments ago too21:30
lkclnotice how it says, ispClock TD*in* is on pin 4 and ispClock TD*out* is on pin 6?21:30
Las[m]Ah, makes sense then21:30
lkclopenocd clearly wants to be "in control" of the JTAG clock speed21:31
lkclrather than syncing to an external one21:31
lkclso now, as long as you have triple-checked the J50 jumper setting, you should be good to go.21:31
lkclmake sure *absolutely no metal* is anywhere near the board21:31
lkclno other cables21:32
lkcland that it's either directly on bare wood21:32
lkclor on the anti-static bag21:32
lkclthat plastic thing with bubble-wrap is **NOT** a good surface to put it onto21:32
lkclit can transmit ESD shock @ 2000 to 5000 v at tiny currents (micro-amps) directly into the electronics, and destroy it21:33
lkclso put it on the silver-looking anti-static bag21:33
lkclor directly onto the wood21:33
lkclonly when you are ready, and everything is totally clear, no possibility of loose cables with metal connectors moving about on the desk and shorting against components21:34
lkcl1) entirely disconnect the USB cable21:34
lkcl2) entirely disconnect the 12v PSU (or better, if it has a switch, flick the switch so that it is "off")21:35
Las[m]I'll put it on the wood, because I don't think an anti-static bag came with it21:35
lkcl3) **WITHOUT** touching **ANY** part of the PCB (hold on to the Ethernet cables or put the PCB temporarily back into the silver anti-static bag)21:35
lkclargh that's really bad21:36
lkclthat's a serious mistake made by the supplier21:36
lkclok grab it by the metal Ethernet and carefully plug in the USB connector21:36
lkclor, hold it by its top and bottom edges21:37
lkclWITHOUT touching components21:37
Las[m]Yeah I've been holding it carefully until now thankfully21:37
lkcl4) very carefully - DOUBLE CHECKING that the PSU is either unplugged (or better switched off)21:37
lkclplug in the 12v PSU21:37
Las[m]There was a miscommunication between me and Restivo which made me think it was the best thing to put it on...21:37
lkclthe 5.1 mm jack needs quite a bit of force21:38
lkclthen, plug in the *other* end of the USB cable21:38
lkclthis should actually power up the FT2322 but it's ok21:39
lkclthen finally switch on the 12 v power21:39
Las[m]I don't think this has a power switch, though I may just not be missing it21:39
lkclit doesn't.21:40
Las[m]It powered on automatically when I put the plug in too21:40
lkcli mean the power switch at the mains which the 12v PSU is connected into21:40
lkclthen you didn't read my instructions carefully21:40
lkcli said, *disconnect* the 12 v PSU entirely.21:40
lkclthat could have been a costly mistake21:40
Las[m]apparently yeah21:41
lkclbecause as the 12v connector comes into contact with the pin and the outer ring, you get "transient spikes"21:41
Las[m]so I should be using a switch to avoid that, even if on the other end?21:41
lkclby disconnecting the PSU, when you plug it back on, it delivers one single "smooth" uplift of 12 v power21:41
lkclwithout any spikes.21:42
lkclyes, really.21:42
lkclplus, because you're putting quite a bit of force on the connector, if you slip it will put 12 v power onto random components21:42
lkclso, anyway, you should be good to go.21:43
lkclas in, re-run the openocd command21:43
lkclor the "make upload" thing21:43
Las[m]Putting the plug into the FPGA, after switching off the PSU, made it light on the FPGA for ~100 ms21:44
Las[m]Is this problematic?21:44
Las[m]oh, it worked21:45
lkclthat's just the capacitors in the PSU discharging21:45
Las[m]The blinking pattern is different, is this a feature of Libre-SOC or Litex or whatever?21:46
lkclok now you should be able to run minicom -D /dev/ttyUSB021:46
lkclor maybe /dev/ttyUSB121:46
lkcland connect to the serial console21:46
lkclls -altr /dev/ttyUSB* first to find out what the name is21:46
Las[m]it seems to be /dev/ttyUSB121:47
Las[m]but it doesn't show anything related to Libre-SOC...?21:47
lkclexcellent, run minicom -D /dev/ttyUSB121:47
lkclit should be running the litex bios at this point21:47
lkclyou might need to reset it (re-run the FPGA upload) to catch it in the act of printing out BIOS messages to the serial console21:48
Las[m]In the bottom it says "... | Offline | ttyUSB1"21:48
lkclif it's showing anything *at all* that's a good sign21:48
lkclah you might need to configure it...21:48
Las[m]yep, I can see it now21:48
Las[m]I have a `litex` prompt but I can't input anything21:49
Las[m]"- bus errors: 2/256"21:49
Las[m]"- addr errors: 32/8192"21:49
lkclyou've got something *at all*21:49
lkclthat's a fantastic sign21:49
Las[m]"- data errors: 524279/524288"21:50
Las[m]Are the errors me having broken the FPGA or an issue with Libre-SOC, or is that not knowable?21:50
lkclthat means it actually tried to even test the DDR3 RAM21:50
lkclwhich is itself a fantastic sign21:50
Las[m]`SDRAM:          131072KiB 16-bit @ 220Mbps/pin`21:50
lkclthe fact that it's reporting that at all is amazing21:51
Las[m]You didn't expect this to work?21:51
lkclof course not! :)21:51
Las[m]I don't know what I would have done if it didn't work lol21:51
Las[m]I've already spent so much time on this21:51
lkclthis stuff is a total pain in the ass, any success is amazing21:51
lkclinitialisation of DRAM is pretty hit-and-miss21:52
Las[m]Is there any chance of me being able to test some PPC software, or is that impossible?21:52
lkclit's timing related and has to be hardcoded depending on the config21:52
Las[m]or is there a test suite I could run?21:52
lkclweeelll... in a few months, maybe21:52
lkclwe're at the "bare metal" stage at the moment21:53
lkclthere's no MMU, no L1 cache yet.21:53
lkclso you can't run linux21:53
Las[m]well yeah I could guess that21:53
lkclbut you are basically already *running* ppc software21:53
lkclthat BIOS was compiled with the compiler you added in to libresoc-litex a couple days ago21:54
Las[m]ah really?21:54
Las[m]well that's pretty nice21:54
lkcllike i said, it's pretty amazing success21:55
lkclbut that BIOS is a bare-metal application21:55
Las[m]is it expected that I can't input anything?21:55
lkcla bit like programming an arduino or an embedded STM32F21:55
lkclsigh, long story, that one21:55
lkclthe version of litex i am using - you upgraded remember - uses "polling" of the litex UART21:56
lkclthere was a fight between Raptor Engineering and Florent21:56
Las[m]`tio` works better21:56
lkclwho refused to accept patches to the interrupt system21:56
Las[m]I can at least press enter21:56
lkclthat's a really good sign21:57
Las[m]it says "Command not found" even!21:57
lkclthat's because there's no commands been compiled in for that (very early) litex bios21:57
lkclupgrading right now isn't recommended21:57
lkclbecause the interrupt mechanism has changed21:58
lkcland the build (libresoc-litex) has to be aware of that21:58
Las[m]You're going to try updating the version of LiteX you're using?21:58
lkclnot unless or until i absolutely need to21:58
lkcland like i said a couple days ago, the focus is on the core at the moment21:59
lkclthere are two priority tasks:21:59
lkcl1) get the pieces in place for SIMD back-end ALUs21:59
lkcl2) get the MMU and L1 cache working, and (Cesar) the LD/ST Exception mechanism22:00
Las[m]Sounds great22:00
lkclwhen we have the MMU unit tests running successfully *then* it is worthwhile considering getting litex up and running with it22:01
Las[m]Hopefully I can get a Libre-SOC ASIC in 202522:01
Las[m]or was it 2023?22:02
Las[m]I think next I'll try getting the entire ASIC build process working, since there's very little left for that.22:02
lkclwe've got to get an NGI POINTER single-core done in 202222:02
Las[m]After that I'll try getting the tests for Libre-SOC working, so you can have CI22:02
Las[m]is that the router thing?22:02
Las[m]Hopefully I can buy it in 2022 then!22:03
lkclalthough if it's practial and there's time i'd like to Mux in Richard Herveille's RGB/TTL code22:03
Las[m]Or make my own possibly!22:03
lkclit'll be a test ASIC, about 160 made22:03
lkcl@ USD 30,000 - 40,000 for those 160 ASICs22:04
Las[m]Not that expensive TBH22:04
lkcl360nm, through Staf Verhaegen's Chips4Makers[m], is only EUR 175022:04
lkcland that's i think 20 ASICs?22:05
Las[m]I have to package that too actually22:05

Generated by 2.17.1 by Marius Gedminas - find it at!