Monday, 2019-04-22

*** tpb has joined #timvideos00:00
*** sb0 has joined #timvideos02:36
CarlFKanyone up on spi and python?02:55
CarlFKI've been at this for 12 hours.  my simple python code is super random, the simple C code is fine02:56
CarlFKhttps://github.com/petrockblog/RPi-MCP23S17  "The following demo" is what I am trying to run02:58
tpbTitle: GitHub - petrockblog/RPi-MCP23S17: This Python module abstracts the GPIO expander MCP23S17 for usage on the Raspberry Pi. (at github.com)02:58
CarlFKC code that works fine  https://github.com/CarlFK/Ripley-1/blob/master/src/tests/23s17.c02:58
tpbTitle: Ripley-1/23s17.c at master · CarlFK/Ripley-1 · GitHub (at github.com)02:58
*** ewen has joined #timvideos03:28
*** rohitksingh_work has joined #timvideos04:49
thaytanhey CarlFK05:02
CarlFKhey thaytan05:02
CarlFKif you are interested in my spi fun, I just filed a pretty well defined bug report https://github.com/petrockblog/RPi-MCP23S17/issues/1005:03
thaytanit's not using the RPI SPI hardware05:04
thaytanbut bit-banging GPIOs05:04
thaytanmight be a timing issue in python05:04
CarlFKThere is spi hardware?!!05:07
CarlFKrage.05:08
thaytanhttps://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md05:08
CarlFKMOSI    P1-19 MISO    P1-21  i'm doing that05:10
thaytanoh, I'm wrong05:12
thaytanmisread the code - it is importing the python spidev module and using that05:12
thaytanso should use the hw SPI if it's enabled05:12
CarlFKwhew.05:12
thaytandid you enable the SPI in the rpi config?05:15
CarlFKyes05:15
thaytancool05:15
CarlFK[email protected]:~ $ lsmod |grep spi05:15
CarlFKspidev                  7220  005:15
CarlFKspi_bcm2835             7520  005:15
thaytanparfait05:17
CarlFKare you familiar with http://wiringpi.com/the-gpio-utility/05:24
tpbTitle: The GPIO utility | Wiring Pi (at wiringpi.com)05:24
CarlFKgpio -x mcp23s08:123:0:0 awrite 0 105:25
CarlFKgpio -x mcp23s08:123:0:0 aread 005:25
CarlFK005:25
CarlFKI expeted 1.  kinda.  not really sure about the 123:0:005:25
thaytanI've done Rpi SPI stuff, but not recently05:27
CarlFKsame withe write/read05:27
thaytanmaybe the spidev module configures a different SPI speed?05:27
CarlFKthat's kinda my guess05:27
thaytanyou could try dropping the frequency05:27
CarlFKim not sure how05:27
CarlFKRe: Change SPI Speed From Python  https://www.raspberrypi.org/forums/viewtopic.php?t=37550#p32002805:29
CarlFKImportError: No module named 'spydev'05:29
thaytanhttps://pypi.org/project/spidev/ says you can set spi.max_speed_hz = 5000 on the spidev module05:30
tpbTitle: spidev · PyPI (at pypi.org)05:30
CarlFKare you sure that code was using the spydev module?05:31
thaytanso MCP23S17._spi.max_speed_hz = 5000 for example05:31
CarlFKimport spidev https://github.com/petrockblog/RPi-MCP23S17/blob/master/RPiMCP23S17/MCP23S17.py#L2905:31
tpbTitle: RPi-MCP23S17/MCP23S17.py at master · petrockblog/RPi-MCP23S17 · GitHub (at github.com)05:31
thaytanCarlFK, good luck. I'm going afk05:33
CarlFKsee ya - thanks for the tips05:33
ewenxobs: re your questions earlier about fupy (which I've just spotted in IRC logs): fupy is essentially a clone of upstream micropython, with a ports/fupy directory added that builds micropython against a litex environment (including getting generated csr.h, etc, copied in).06:42
ewenxobs: I suspect it only properly builds in the context of litex-buildenv at present (scripts/build-micropython.sh) due to the files copied in.06:43
xobsewen: I thought it might be something like that.06:43
xobsI wasn't sure if it required any other patches.06:43
ewenxobs: Also last I knew only the lm32 CPU version *actually worked*.  There's incomplete ports to or1k and risc-v, but IIRC each time people checked they found they didn't work to boot properly.06:43
ewenxobs: In theory if you use litex-buildenv, scripts/build-micropython.sh, and lm32 as the soft CPU, it should build.  IIRC I last tested it about 3 months ago.06:44
xobsI created the usb-cdcacm Fomu example project as a precursor to trying Fupy again.06:44
ewenxobs: For your purpose (vexriscv) I suspect it'd probably help if someone made sure the RISC-V fupy (or micropython?) actually worked...06:45
ewen... which last I knew it didn't, for reasons unknown.06:45
CarlFKlm32 and risk-v are different endian (circuit-python dropped support for one)06:52
xobsI thought they dropped support fir Big, because nearly everything today is Little.06:53
xobs(including RISC-V)06:53
futarisIRCcloudI suspect there is less work in getting Zephyr to run. First thing we need to do is get a qemu litex model for vexriscv.06:59
CarlFKI could be wrong - I was making a run to port circuit-python using the patches to micro-python and bumped was told something like "not a chance... because endian"07:04
ewenFTR, last I knew riscv/or1k micropython didn't produce any serial output at all (ie, didn't even boot).  That could be endian issues I suppose, but in practice I'd expect endian issues to be more subtle (ie, some things work, other things go wrong).07:17
ewen(My guess is that there are IRQ / serial / etc things not wired up right for those cPUs.)07:17
ewenAlso FTR my recollection is last time fupy was sync'd with upstream micropython was when I did it at PyConAU 2018 (August 2018); there's been at least one upstream MicroPython release since then.07:18
ewenxobs: Also in case it helps, fupy has only ever been used with hard wired serial (ie, no USB CDC support).  Eg, on TinyFPGA BX it's only usable via external USB-serial.  (On some other platforms like Mimas V2 / Arty it relies on the FTDI, etc, chip on the board to convert hardwired serial to USB.)  For your purposes that might be a show stopper, depending on FPGA space needed for USB stack including hard07:28
ewenwired serial to USB CDC logic...07:28
xobsewen: why would it need hard-wired USB CDC logic?07:33
ewenxobs: as currently used MicroPython brings up a REPL, for interaction via a serial port.07:34
ewenxobs: that serial port is basic RS232-style serial port from the soft-CPU devices.07:35
ewenxobs: For the Fomu only the EVT has a TX/RX serial port connection... so to work for hacker/production Fomu it'd need something to tunnel serial IO out via USB...07:35
xobsThat was my plan.  To have it enumerate as a CDC ACM device over USB, and present a normal serial port to Micropython.07:36
ewen(I guess it'd be possible to use MicroPython only via pre-loaded .py files, if there was some method provided to upload them.  But seems like debugging would be non-trivial :-) )07:36
xobsOr does micropython require more over USB?07:36
xobsLike, does it require MSC?07:36
ewenMicroPython itself doesn't require any USB AFAIK.07:37
ewenBoth for REPL with no physical serial wiring, it'd help to have some way to show the user the REPL/console/serial IO... :-)07:37
ewenxobs: https://docs.micropython.org/en/latest/library/pyb.USB_VCP.html seems to some extension.  (Not sure if the same approach can be used for the MicroPython REPL.)07:38
tpbTitle: class USB_VCP – USB virtual comm port MicroPython 1.10 documentation (at docs.micropython.org)07:38
ewenxobs: Ah, I've realised what you're asking about re MSC (USB Mass Storage).  Yes, ideally MicroPython would have access to some storage it could load .py files from.  But IIRC it can run entirely with what's pre-linked in, plus user-entered Python at REPL.07:41
*** ewen has quit IRC09:32
futarisIRCcloudhttps://github.com/micropython/micropython/tree/master/ports/zephyr09:37
tpbTitle: micropython/ports/zephyr at master · micropython/micropython · GitHub (at github.com)09:37
*** mauz555 has joined #timvideos12:21
*** futarisIRCcloud has quit IRC12:49
*** rohitksingh_work has quit IRC12:58
xobsI got it to the point where it initialized and printed out a banner, but I think the gc was causing all sorts of issues.  Need to investigate that.14:39
CarlFKneat14:40
xobsI don't know if that's a "well it's almost there" issue, or a "computer vision as a summer project in 1966" kind of issue.14:41
CarlFKlol14:41
CarlFKsounds like my spi problem.  I'm sure I just need to set a setting and it will all just work14:42
CarlFKdo you have a MCP23S17   and an hour to wire it up and debug my problem? :D14:43
daveshahHave you seen https://github.com/mmicko/micropython/tree/legacy/ports/picorv32? micko got micropython working on picorv3214:44
tpbTitle: micropython/ports/picorv32 at legacy · mmicko/micropython · GitHub (at github.com)14:44
xobsdaveshah: I hadn't seen that, neat!14:46
xobsIt could be that my implementation of setjmp/longjmp is bad, and I should just let it link in libc.  But last time I tried that the code size blew up.14:50
daveshahI've seen crashing after the banner before, turned out I had a libc built for rv32ic but picorv32 configured as rv32i14:51
xobsI was getting a ton of corruption.  Bad USB descriptors, frequently failing builds, that sort of thing.14:52
xobsI thought it could be a caching issue, because it kind of smells like one.  But I still think it's the gc running oddly.14:52
xobsHow does this thing even work?  It looks like the gc searches the stack between main() and when gc_collect() gets called, which doesn't seem right.15:25
*** Toba has quit IRC15:36
*** mauz555 has quit IRC16:42
*** mauz555 has joined #timvideos16:43
*** mauz555 has joined #timvideos16:43
*** mauz555 has quit IRC17:01
*** mauz555 has joined #timvideos19:00
*** Toba has joined #timvideos19:11
*** Toba is now known as Guest5119319:11
*** mauz555 has quit IRC19:20
*** puck_ has quit IRC19:37
*** CARAM_______ has quit IRC21:02
*** CARAM_______ has joined #timvideos21:09
*** CARAM_______ has quit IRC21:10
*** CARAM_______ has joined #timvideos21:16
*** mauz555 has joined #timvideos22:00
CarlFKin CPX land: It looks like I’ll need to upgrade to at least a slightly better logic analyzer to be able to capture full speed USB.22:02
*** techman83 has quit IRC22:06
*** fischerm has quit IRC22:06
*** springermac has quit IRC22:07
*** fischerm has joined #timvideos22:07
*** techman83 has joined #timvideos22:07
*** ChanServ sets mode: +v techman8322:07
*** springermac has joined #timvideos22:09
*** springermac_ has joined #timvideos22:15
*** springermac has quit IRC22:15
*** springermac_ is now known as springermac22:15
*** thaytan has quit IRC22:18
*** thaytan has joined #timvideos22:20
*** ChanServ sets mode: +v thaytan22:20
*** paddatrapper_ has joined #timvideos22:22
*** paddatrapper has quit IRC22:24
*** mauz555 has quit IRC22:24
*** medicalwei has quit IRC22:27
*** medicalwei has joined #timvideos22:27
*** futarisIRCcloud has joined #timvideos23:01
*** CarlFK has quit IRC23:02
futarisIRCcloudCarlFK: What do you want to capture full speed USB for? There was good video that outlined the (cheap) options (on #timvideos or #tomu) a few weeks ago...23:04
CarlFK[m]I don't, someone else said that. I see it didn't copy paste his Nick. I'll follow up on that in an hour or so.23:05
futarisIRCcloudxobs / daveshah: That micropython for riscv32 looks promising. Any idea why it's not upstream?23:06
futarisIRCcloudCPX land?23:06
futarisIRCcloudhttps://github.com/mmicko/micropython/commit/e6240249a18cc7bfc11b13002ac999d5691e013d - seems to have the main diff...23:12
tpbTitle: Aded RISCV support for Freedom-E-SDK boards · mmicko/[email protected] · GitHub (at github.com)23:12
futarisIRCcloudhttps://github.com/mmicko/micropython/commits/legacy?author=mmicko seems to be an older branch.23:12
tpbTitle: Commits · mmicko/micropython · GitHub (at github.com)23:12

Generated by irclog2html.py 2.13.1 by Marius Gedminas - find it at mg.pov.lt!