Wednesday, 2020-08-05

*** tpb has joined #tomu00:00
scientesxobs, ^05:56
*** tcal has quit IRC09:23
*** craigo has quit IRC12:00
*** coderobe has quit IRC12:42
*** coderobe has joined #tomu12:43
*** emeb has joined #tomu14:04
xobsI'm not sure what it could be. selinux?14:42
*** alexhw has quit IRC14:43
scientesgregkh in #kernelnewbies wasn't sure either14:45
scientesthe error is when it asks it to change modes14:45
scientesbut there are also errors when i do lsusb -v14:46
scientestime outs14:46
scientesbut no kernel messages for those time out14:46
xobsWait, so once you load `blink-extended` onto that Fomu, it will never work again on that machine?14:47
scientesit works on another machine however14:47
scienteswhile the blink-extended program is running14:47
scientesbut yes14:47
scientesi managed to upgrade the bootloader on another laptop14:48
xobsBut if you plug it into your Thinkpad you can't see it anymore when you do `lsusb`.14:48
scientesI can14:48
scientesI can see it14:48
scientesbut lsusb *-v* has timeouts on certain requests14:48
scienteslsusb works fine14:48
xobsThat's interesting. Because loading a program such as `blink-extended` shouldn't affect `foboot` at all.14:49
scientesthe program is running right now14:49
scientesso its a problem with the reset?14:50
scientescause it blinks the whole time I am trying to program it14:50
scientesis it suppose to stop blinking when it is reset?14:50
xobsWhat color is it blinking?14:50
scientesgreen i believe14:51
xobsWhere are you getting `blink-extended` from?14:51
xobsIs it from
tpbTitle: fomu-workshop/verilog/blink-expanded at master · im-tomu/fomu-workshop · GitHub (at
scientesI just ran make and then dfu-util -D14:52
scientesI am not good with colors, I can take a video14:52
xobsInteresting. There appears to be a critical piece of information that's missing from the README files.14:53
xobsThe USB core is in the FPGA gateware itself. Foboot is actually a CPU + USB + ROM. When you load your own Verilog code, such as the blink example, it reconfigures the FPGA to be whatever program you loaded.14:54
tpbTitle: Imgur: The magic of the Internet (at
xobsSince you didn't load a USB core, it isn't a USB device anymore.14:54
scientesxobs, yeah I got that from the docs, but I thought there is a special reset14:55
scientesthat reloads into the bootloader14:55
scientesthe riscv example docs kinda say that14:55
xobsThere is -- you can hit `SB_WARMBOOT` from your Verilog code.14:56
scientesthen how the hell does the other laptop do it?14:56
xobsBut the question is how to trigger that.14:56
xobsSince it's not a USB device anymore.14:56
scientesbit the other laptop worked????14:56
scientesusually you have a boot sequence that can be interupted on these type of things14:57
scientesand you just reset and then do your thing14:57
scientesand the cheap way to do it is to have it boot off the host14:57
scienteslike the sheevaplug had tftpboot14:57
xobsThat works if you're using the CPU that's part of Foboot. But since you're in Verilog land, you must first invent the universe.14:58
scientesbut again, why did it work in the laptop?14:59
scientesthe other laptop14:59
scientesOh I see, that is why other FPGA boards have USB serial chips14:59
xobsI think it may be a bug.14:59
scienteswhile this one is kinda funky to just have that part of the FPGAs duties14:59
xobsThese pins should be floating, not `0`:14:59
tpbTitle: fomu-workshop/blink.v at master · im-tomu/fomu-workshop · GitHub (at
xobsThey're kinda breaking spec as-is.15:00
xobsSo perhaps your other laptop didn't interpret that as a disconnect. Or maybe the Thinkpad did.15:00
scientesso what it should do is to reset when there is a usb change mode command15:00
xobsThey should be 1'z not 1'0.15:00
scienteshmm verilog land is like way less mature than even C-land15:01
xobsscientes: That requires you to implement USB in Verilog, or port Valentyusb to Verilog to support that. Doable, but it's a lot of baggage to bring in.15:02
*** alexhw has joined #tomu15:02
scientesis usb that gross?15:02
xobsIt's like saying it's easy to display a JPEG file from a console, all you need to do is start a Wayland server.15:03
scientesyeah I get it15:03
scientesyeah that makes sense actually, I imagine how hard it would be to recieve a ethernet packet15:03
scientesonly serial is easy to implement15:03
xobsUSB on Fomu is made particularly icky by the fact that it's split into two clock domains to meet timing, and the fact that it's 4x oversampled. Clock sync is hard.15:03
scientesso that is why TinyFPGA has a FT2232 chip15:04
scientesor whatever that common usb serial chip is called15:04
scientesit makes it way easier on the fpga15:05
xobsYeah, that's why a lot of those boards use external serial devices, and program the SPI flash using auxiliary GPIOs.15:05
scientesso what does doing "1'z" do?15:05
scientesoh z is a floating point literal15:05
xobsOn the flipside, it means Fomu can be many things, which is why Circuitpython lets us be things like a keyboard/mouse/uart/disk.15:05
scientesbut z floating point is the same as a 0 integer15:05
scientes*zero floating point15:06
xobs`z` means "Hi-Z"15:06
xobsBoolean values in Verilog have at least four values I'm aware of (VHDL bools have 9 possible values -- welcome to hardware).15:07
scientesthis definitely makes it trickier to do toolchain dev. which is what I was interested in15:07
scientesoh wow, I have lots to learn15:07
scientesin SQL bools are a tristate15:07
xobs`0`, `1`, `x`, and `z`. 0 and 1 you know, `x` means unknown, and `z` means hi-impedance. Which if you're used to normal GPIOs can sometimes be thought of as "input".15:08
xobsRight now that line is setting USB to drive 0 onto the D+/D- pins. What it should be doing is setting it to `z`, which means "don't drive anything, just let it float".15:09
scientesunknown would be "undefined" in llvm then?15:09
scientesso gregkh knew exactly what was happening :)15:10
xobsI see "unknown" mostly in simulations.15:10
xobsAh, `X` can also mean "Don't care".15:12
scientesyeah now i understand what "high-impedence" means15:12
scientesit means it isn't grounded to anything15:12
scientesin any way15:12
scientesso it doesn't look like a wire15:13
xobsFor example, you can make an address decoder that looks for `8b101xxxxx`, and will match `8'10100000', `8'10100001', and so on.15:13
scientesso why does the bootloader show up in lsusb?15:17
scientesI am still confused about what is happening15:17
scientesBus 001 Device 080: ID 1209:5bf0 Generic Fomu PVT running DFU Bootloader v2.0.315:17
scienteswhere is that string?15:17
xobsThe bootloader has a CPU + USB + ROM, and the CPU configures the USB core to work with Linux.15:19
xobsRather, to work with your machine.15:19
scientesbefore loading the program15:19
scientesdamn, that must happen *fast*15:19
scientescause it starts blinking immediately15:19
xobsHere's the reference manual for the USB core (and the whole CPU) that Foboot runs on, and that gets used when you load a RISC-V program (as opposed to a Verilog program):
tpbTitle: USB Fomu Bootloader documentation (at
xobsI want to say 150ms, but I feel it's faster than that. 40ms? I'd have to consult the ICE40 reference manual.15:20
scientesso the problem is that it sees it as a usb device15:21
scientesand if it didn't it just resets it?15:21
scientes*if it does not see it as a usb device15:21
scienteswow, this is actually quite liberating15:27
scienteslike i could get this
tpbTitle: Pmod CAN: CAN 2.0B Controller with Integrated Transceiver - Digilent (at
scientesand write a proper AF_CAN driver for linux15:27
scientesthis is way better than AVR-8 can because you can just *be* the cpu is you want15:28
scientesI had a can device one that was one of those microcontrolers and avr-8, but then the linux driver was serial+nodejs!!!!!15:30
xobsVery zen. Be the CAN.15:30
*** xkapastel has joined #tomu15:39
scientesso dfu-util should have a pre-reset mode15:53
scientesto knock it into the bootloader15:53
*** CarlFK has joined #tomu15:57
*** ssb has quit IRC17:18
*** ssb has joined #tomu17:26
*** craigo has joined #tomu19:04
*** xkapastel has quit IRC20:19
*** Joel__ has quit IRC20:51
*** Joel__ has joined #tomu20:53
*** xkapastel has joined #tomu21:34
*** coderobe has quit IRC23:12
*** coderobe has joined #tomu23:13

Generated by 2.17.2 by Marius Gedminas - find it at!