Thursday, 2018-06-07

*** tpb has joined #tomu00:00
xobsTechAspirer: The OpticSpy demo was used as part of the OpticSpy workshop at Teardown.  Tomu acts as a transmitter and the OpticSpy acts as a receiver.  If you type some text the LED will start flickering at 19200 baud.00:59
*** tomu-ci has joined #tomu01:03
tomu-ci[] xobs pushed 1 new commit to master: 97db1b4 Sean Cross: samples: add arm-none-eabi-newlib to arch deps...01:03
*** tomu-ci has left #tomu01:03
*** k-man has joined #tomu01:06
TechAspirerGot it. Thanks xobs02:53
TechAspirerI have to debug this LED code but then I'll check it02:54
TechAspirerStart off. 5 seconds turn both LEDS on. 5 seconds turn both off. I'm getting Both, Red, Green, off.02:55
TechAspirerMissing bool invert. Works now :D02:56
TechAspirerxobs: I have something for you02:56
xobsTechAspirer: Is it a pull request?03:13
xobsActually, if anyone feels like poking at the captouch stuff, it's in the "quickstart" repo.  I wrote it while on a plane, and it's mostly for debugging.03:13
xobsIt's also a good example of a serial interface over USB.03:14
TechAspirerIt's a git repo of my own03:17
TechAspirerFinalizing it now03:18
TechAspirerAnd I want a digital button thing :P But that's likely analog with > HALF03:18
TechAspirerxobs: Who's the owner of the copyright for the Quickstart repo?03:20
TechAspirerBecause you just copied in the Apache license03:21
TechAspirerIncluding the part that says how to use it03:21
TechAspirer"APPENDIX: How to apply the Apache License to your work." "Copyright {yyyy} {name of copyright owner}"03:22
xobsLicensing is hard.03:23
TechAspirerSo who owns the copyright and what year is it?03:25
TechAspirerI need to know before I can upload my code03:25
TechAspirerIs it xobs, your real name, The Tomu Foundation,
xobslibopencm3 is the owner of the libopencm3 repo, though some of their headers come from CMSIS. I'm the owner of some of the demos, others come from the samples repo.  The bin/ directory contains files generated by the dfu-utils project.  The README is mine, and the license is the Apache foundation.03:26
TechAspirerGod damn it03:27
TechAspirerWhat about the makefile03:27
TechAspirerThat's the part I'm editing and redistributing03:27
TechAspirerAnd I wasn't saying GDI to your response. It's very helpful. I was saying it about the situation.03:27
TechAspirerGecko SDK?03:28
xobsI'd say the Makefile is mine, 2018, distribute however you like.  I find it useful, and would like to get it out there.03:28
xobsAssuming you mean the one from quickstart.  Makefile.common03:29
TechAspirerWhat's your first and last name or should I use xobs?03:29
xobsSean Cross03:29
TechAspirerThank you03:30
TechAspirerxobs: SO03:36
TechAspirerThis is way lower level than I expected03:37
TechAspirerI'm both coping and excited03:37
xobsHow do you mean?03:37
TechAspirerI mean I backed this months ago on Crowd Supply and was more expecting a command line build of GCC and a few headers that allowed Arduino like access03:38
TechAspirerNo IDE. Nothing fancy. No need to use libopenmc3 to turn a LED on03:38
TechAspirer*backed months ago and walked away without doing further research03:38
TechAspirerIt is my fault :P Not blaming anyone.03:38
TechAspirerAnyways, point was, I made some headers03:38
tpbTitle: LTE/main.c at master · kayabaNerve/LTE · GitHub (at
TechAspirerIt blinks every 5 seconds with both LEDs and turns off03:39
TechAspirerI made a tomu.h to handle the watchdog/toboot, timer, and infinite loop, and LED header to handle the GPUO03:40
TechAspirerSo now all I have to do is declare main, start tomu(), start led(), declare my every milisecond function, and call the infinite loop03:40
TechAspirerIt makes the hardware more accessible. That's all I'm saying.03:41
TechAspirerI'm not saying that's the goal of this.03:41
TechAspirer*this = Tomu, not my headers.03:41
TechAspirerAny thoughts? Hate it? Out of place for Tomu? Could help the community? Happy to see someone writing code based on Tomu?03:48
xobsTechAspirer: I think I need to replace Weechat.  I sent some replies but they got eaten...04:18
TechAspirerDunn dunn dunn04:19
xobsTechAspirer: I think it's cool!  It could help the community for sure because it makes it easier to figure out what's required to write something.04:19
TechAspirerI'm on the webchat right now04:19
xobsYou probably want to make your header functions "static inline" to avoid linker errors when you include them twice.04:20
TechAspirerHappy to hear it. I was worried you'd think it's destroying the purpose of having such low access to an ARM chip like this...04:20
TechAspirer#ifndef #define #endif04:20
TechAspirerOr is that not valid?04:21
TechAspirerAnd I think this is wrong I'm prett04:21
tpbTitle: tomu-quickstart/miniblink.c at master · im-tomu/tomu-quickstart · GitHub (at
TechAspirer*pretty sure that when you use 5k, it's running every 3.3 seconds04:21
xobsI'm sad micropython/elua/espurino are too large.  I've thought about porting one of the BASIC interpreters...04:22
TechAspirerAm I missing the point of the modulus or is the tick frequency too fast?04:22
xobsMy guess is the systick frequency is too fast.04:23
xobsOr rather, not accurate.04:23
xobsTomu has no crystal, so it relies on PLLs that aren't very accurate.  They'll be off by a few percent.  Though probably not off by the 30% you're seeing...04:24
TechAspirerIt's running 14000 times per second, according to that AHB clock04:24
TechAspirerWhich your comment says is the core04:24
TechAspirer5.5/1.4 = 3.904:25
TechAspirerSo I could just be off 0.2 seconds on my stop watch04:25
xobs0.2 seconds sounds like it's more in line with PLL drift.04:26
xobsSo it might make more sense to increment a counter, and when it hits 14 then increment the milliseconds counter.04:27
TechAspirer714 tick frequency04:27
TechAspirerNot 1k04:27
TechAspirer3.3 -> 4.704:28
TechAspirerI'd just round to 700 tbh. I know the drift is random and both ways but 700 is neat and in my single measurements is closer to 504:28
tpbTitle: LTE/tomu.h at master · kayabaNerve/LTE · GitHub (at
TechAspirerI'll start editing the quickstart repo now and submit a pull request, if you want04:33
TechAspirerMiniblink 1000 to 700 and USB-HID 100 to 70.04:33
xobsTechAspirer: What if you switch to using the USB clock?04:34
TechAspirerI have no clue how to do that04:34
xobsThese two (three?) lines:
tpbTitle: tomu-quickstart/opticspy.c at master · im-tomu/tomu-quickstart · GitHub (at
TechAspirerLooking at it now04:35
xobsI *think* it'll run systick at 24 MHz.04:35
TechAspirerDoes that require 419 and 420 though?04:36
TechAspirerBecause that should help a lot but I'm curious what side effects starting the whole USB stack does04:37
TechAspirerEven though I'll probably do that at some point somewhere04:37
xobsIt shouldn't be necessary, but let me find my Tomu and do some investigation first.  It may be possible to just ungate those clocks.04:38
TechAspirerMy Tomu thingy is red04:53
TechAspirerNot flickering04:53
TechAspirerSo either this interrupted my code before it could turn the Red LED off as it turns green off first04:53
TechAspirerOr Toboot is asking me why I murdered it04:53
TechAspirer*interrupted and halted04:53
TechAspirerRIP my almost twice as fast and more accurate clock speed05:01
xobsThis should do it:
tpbTitle: tomu-quickstart/miniblink.c at master · im-tomu/tomu-quickstart · GitHub (at
xobsIt's probably waiting for the clock to tick, but it's not enabled, so it's just sitting there.05:09
xobsIt turns on the USB oscillator, waits for it to come ready, enables trim support, and then switches to using it.05:10
TechAspirerCool! Thanks xobs05:18
TechAspirerAlso, I have a compiled version of this which I compiled before, but for some reason my compiler isn't recognizing asm()05:19
TechAspirerI did revert to your makefile to see if I messed it up05:19
TechAspirerStill throwing an error05:19
TechAspirer4.9X seconds. Works great.05:23
TechAspirerFixed the asm issue05:26
TechAspirerOnly now have I learned the LEDs used inverted logic05:35
TechAspirerI set them up, set them, cleared them, and then toggled them. Init, off, on, off.05:36
TechAspirerxobs: Your serial ASM. Can I just nop 24 times?05:44
TechAspirerYour ASM loops 1000 times over an ASM loop that does 4 instructions 6 times05:45
xobsTechAspirer: For the sleep?05:46
TechAspirerCan't I just do a for loop 6000 times?05:46
TechAspirerThat's the 1000 it had plus an extra 6000 in C05:46
TechAspirerfor (int i = 0; i < 24000; i++)05:47
TechAspirer*7000, not 2400005:47
xobsYou can try.  I was having a lot of trouble fighting compiler optimizations, which is why I switched to the inline asm implementation.05:47
TechAspirerHow exact does it have to be?05:47
xobsThe cycle counts are at and most instructions are 1 cycle.05:51
tpbTitle: ARM Information Center (at
xobsThe udelay_busy() function was good enough to send serial data out an LED, which has somewhat tight timing requirements.05:52
TechAspirerOh. I don't care about the LED.05:55
TechAspirerJust the serial05:55
xobsUSB serial, or are you attaching wires to Tomu's Tx and Rx pins?05:56
TechAspirerAnd I do know of your usb.h. Just looking over both05:58
xobsUSB serial timing really isn't super important.  Baud rate doesn't matter when you're going PC <-> Tomu.  Any baudrate works fine.05:59
TechAspirerGot it. Thanks06:00
TechAspirerSo I can just remove the loop for USB?06:01
xobsWhich loop?06:01
TechAspirerThe sleep loop06:02
TechAspirerThe one we've been discussing. udelay_busy06:02
TechAspirerAlso, there's so much bloat in the USB protocol.06:03
xobsYes, you can remove that loop.06:03
xobsThe reason it's part of usb_puts() is due to buffer drain.06:03
xobsusbd_ep_write_packet() copies the data to a USB buffer and returns immediately.  The host will, at some point, request the data.06:04
xobsWithout that delay in there, you could write to the buffer twice and the first write would be dropped.06:04
xobsThe udelay_busy() is there to ensure the buffer has drained, as the host should be polling at ~1ms intervals.06:04
TechAspirerSo then I can't remove it?06:05
TechAspirerI mean, I can delete all of this code06:05
xobsIt's there to enable doing things like 'printf("Hello, "); printf("world!");'.  If you don't want to do that, it's safe to remove.06:08
TechAspirerGot it06:09
xobsA better solution would be to wait for the buffer to be drained...  but I haven't looked into doing that.  Patches welcome!06:09
TechAspirerI hate USB06:27
TechAspirerI used to not care06:27
TechAspirerThen I started working on it06:27
*** k-man has quit IRC06:40
*** k-man has joined #tomu06:51
MadHackerAre the various crowdsupply tomu's making it out, then? I had ordered parts for making my own as well as a CS order, but I've had neither PCBs back nor boards from CS.07:47
xobsMadHacker: They've shipped!  Most of them, I think.07:48
MadHackerAlas, I've just logged in to my CS order, says "Currently expected to ship on Jul 31, 201807:48
MadHackerGuess I'm in the back of the queue.07:48
MadHackerIt's a race to see which boards arrive first. :D07:49
xobsMost of the 10-packs, at least.  And half the 5-packs.  CS is just churning through the units I sent there.07:50
MadHackerI'm on a five-pack. I figured I'd like some "real" ones, but I'm more likely to DIY some stuff based on the same chip myself if I want more than that.07:51
MadHackerAlso I want to play with the cap touch stuff on the official PCBs so that if I come up with anything cool it's usable by other people.07:52
MadHackerI'm very curious to see if I can get some gestures out of it, not just touch.07:52
xobsI'm curious, too.  It's using your suggestion with vias encaging the pads.07:56
MadHackerCool. It'll be good to play.07:56
MadHackerThe parallel-to-your-finger-ness of the vias should increase the detectable capacitance change.07:57
MadHackerThere are some more subtle tricks you can do when you have two cap touch pads and some expectation of overlap of the finger between; you can set up a three-plate capacitor which can be a bit more sensitive.07:58
MadHacker+ give ratio of coverage, not just touch/no touch.07:59
xobs I really look forward to what you come up with.08:00
MadHackerLooking forward to playing.08:00
xobsHere's my current progress:
tpbTitle: tomu-quickstart/main.c at master · im-tomu/tomu-quickstart · GitHub (at
MadHackerYep, I saw that already. Work at all?08:01
xobsIt uses the hardware timers for the two pads that support it, and charge/discharge for the other two pads.08:01
xobsIt kinda works.  Sort of.  It can detect touches, at least.  But weirdly the two hardware-capable pads were behaving differently.08:01
MadHackerBig frequency difference noticable on them?08:02
xobsOne was 800-1200, the other was 1-208:02
MadHackerSounds like a passive pull-up/pull-down left enabled on one?08:02
MadHackerSomething making it discharge a lot faster.08:03
MadHackerCould check the impedance to ground and to the power rails with the board powered down, too - see if there's some static loading.08:04
TechAspirerMadHacker: I got my 5 pack 2 days ago (after midnight now)08:06
TechAspirerReally more like 1.508:06
TechAspirerxobs: What's this usb_isr function? It isn't called by anything. Is it dead code that got shipped in or expected by the libopenmc3 library?08:08
xobsTechAspirer: It's an Interrupt Service Routine.  It's called by the hardware every time a USB event comes in.08:08
xobsIt's kind of a hardware callback.08:08
TechAspirerGot it08:08
xobsMadHacker: The GPIO block on the EFM32 is so weird.  There just isn't any pinmux.  If you use a block, GPIO is disabled.08:16
MadHackerThe PICs (well, at least the earlier) have that with the ADCs, but not otherwise. It's quite irritating because they default active, so to turn a pin into a GPIO you need to issue a whole bunch of shutdown pokes to the various functions.08:18
MadHackerYou'd think everyone would make everything start up as generic GPIO w/ everything tristated by default, but that's a surprisingly uncommon configuration in my experience.08:19
TechAspirerxobs: Changing the names of these USB strings stops the Serial from even working... Weird08:56
TechAspirerI tried, "Tomu", "Tomu 2", "Tomu 3". Crash08:56
TechAspirerI tried just "Tomu", changing 3 to 1. Crash.08:57
xobsTechAspirer: Which project are you lookingat?  usb-cdcacm?09:01
TechAspirerOr usb-cdcacm09:11
TechAspirerPick either09:11
xobsTechAspirer: Ah, I have a feeling I know what's going on.  It's probably alignment, caused by compiling with -Os.  I bet it tries to copy data using 32-bit ints, which gives a 4x speedup.09:15
xobsDo you have arm-none-eabi-gdb installed?09:15
TechAspirerNo idea09:18
MadHackerCould try using a name that's a multiple of four long. :)09:18
xobsThat's true.  Does "TomuTomu" work?09:18
MadHackerTomu 001, even make it sound like it's *supposed* to have placeholder digits. :D09:19
TechAspirerI was going to just remove -Os09:21
TechAspirerOh. BTW. Suggested edit to the core mainfile: -specs=nano.specs -specs=nosys.specs09:22
TechAspirerClears up _sbrk errors09:22
TechAspirerDoesn't break anything so far.09:22
MadHackerxobs: On the subject of the quickstart, on Windows I get "make: copy: Command not found", presumably because copy isn't a command that make can run, it's a cmd.exe builtin.09:22
MadHackerProbably could subsitute xcopy which has an actual .exe09:22
TechAspirerI'm not making a pull request because I don't know the full effects of it09:22
TechAspirerJust suggesting it09:23
TechAspirerxobs: I don't get that09:23
TechAspirerDid you get GNU Make from SourceForge?09:23
MadHackerLiterally grabbed the links given on the quickstart page. This is on Windows BTW.09:23
MadHackerIt's possible I have another copy of make here, of course.09:23
MadHackerAnyway, just swapped in xcopy instead, and that works fine.09:23
xobsMadHacker: I'll do that replacement.  "copy" works for me, but xcopy should work too.09:24
TechAspirerconst char* usb_strings[] = {     "Tomu",     "TomuTomu",     "TomuTomuTomu", };09:27
TechAspirerMultiples of 4 failed09:27
MadHackerxobs: "cmd /c copy" works better than xcopy actually, avoids a prompt for file/dir when the file isn't already there.09:30
MadHackerSorry for spotting that a bit late.09:30
xobsMadHacker: I was just debugging that.  Placing a * at the end of the name works too.09:30
MadHackercmd /c copy is a bit crude, but less reliant on anything undocumented.09:31
TechAspirerJust tried const char* usb_strings[] = {     "aaaa",     "zzzzzzzzzzzzzzzzzzzz",     "bbbbbbbb", };09:42
TechAspirerExact same length as the strings, in the same length order, with no strings starting the same09:43
TechAspirer(I was thinking if you have one thing named "Tomu", having another named "TomuAppendix" may throw an error)09:43
TechAspirerAlso trued  keeping the name Tomu09:44
xobsAlright, sorry I need to rush out for the day.  That's a strange issue, and I really wonder what could be causing it.09:53
TechAspirerAll good09:53
TechAspirerMinus the naming issue, I finished my Serial library10:15
tpbTitle: LTE/main.c at master · kayabaNerve/LTE · GitHub (at
TechAspirerxobs: Is this the first game played on a Tobu?10:38
TechAspirerUses my Tomu header, Serial header (the whole point), and LED header for good measure10:38
TechAspirerOnly read the source if you want to know the answer to the Tomu's favorite fruit. Putty with 19200 baud is how you play ;)10:39
*** k-man has quit IRC10:58
*** k-man has joined #tomu11:06
*** k-man has quit IRC12:56
*** k-man has joined #tomu13:06
xobsTechAspirer: As far as I know it is!13:28
MadHackerTwo tomus would be enough for a reasonable Simon game...13:43
MadHackerNo inter-tomu communications though. Hm.13:43
MadHackerAh well. Maybe w/ gestures.13:43
*** k-man has quit IRC14:02
*** akent has joined #tomu14:03
*** k-man has joined #tomu14:06
*** akent has left #tomu14:40
*** k-man has quit IRC14:54
*** k-man has joined #tomu15:06
*** k-man has quit IRC15:56
*** k-man has joined #tomu16:06
*** NoGodDamnIdea has joined #tomu18:05
*** im-tomu has left #tomu19:04
*** im-tomu has joined #tomu19:04
*** im-tomu has left #tomu19:09
*** im-tomu has joined #tomu19:09
TechAspirerMadHackers: Build a Serial proxy app on your laptop20:09
TechAspirerOr connect the TX/RX lines20:23
*** NoGodDamnIdea has quit IRC22:43
TechAspirerxobs: do you know if the rand() seed is iterated over by time since Toboot exited or if it's calls to rand()?23:05
TechAspirerI'm guessing it's the second. I ran the same program and twice and got 4, with an instable clock (no crystal)23:05
TechAspirerSo even if I iterate in a for loop 1k times, it doesn't matter. Right?23:06
TechAspirer*1000 times just to call nop.23:06
TechAspirerThough since the clock is instable, I could use srand based on the miliseconds...23:11
TechAspirerOr no because that's based off cycles and the cycles to execute the program is constant23:12
TechAspirerSo I guess I'd hook one of these up to GPIO
tpbTitle: Random Sequence Generator based on Avalanche Noise (at
TechAspirerAlso, how do you expose the GPIO if it's in the USB port? Half port length USB cable?23:16
TechAspirerI'd buy a Tomu USB cable that exposed a couple GPIO/TX/RX and had a switch so I'm not unplugging constantly23:16

Generated by 2.13.1 by Marius Gedminas - find it at!