2025-06-22 00:00:48 yep tabemann it's working perfectly 2025-06-22 00:00:51 fucking YES 2025-06-22 00:01:09 https://gist.github.com/lf94/95d4b82c94ad8a6467708d6219c8cf6b for those following at home 2025-06-22 00:01:29 I accidentally reversed HIGH/LOW also 2025-06-22 00:05:32 congratulations! 2025-06-22 00:05:46 next phase: figure out what's up with the timer 2025-06-22 00:05:52 are they actually Raspberry Pi products? 2025-06-22 00:05:55 or are they clones? 2025-06-22 00:06:05 looks like the real chip on there 2025-06-22 00:06:25 maybe you can test if they fixed the erratum with the power wastage ;) 2025-06-22 00:06:28 RPI Foundation has been good for these microcontrollers 2025-06-22 00:06:45 In terms of selling to product manufacturers 2025-06-22 00:07:00 How do I test that 2025-06-22 00:11:40 I love how clean my Forth looks 2025-06-22 00:13:32 Oh nice the timer is working 2025-06-22 00:15:45 back 2025-06-22 00:15:54 we're so back 2025-06-22 00:15:56 B) 2025-06-22 00:16:33 variable paddle.request-check 0 paddle.request-check ! 2025-06-22 00:16:36 Is there really no nicer way to do this 2025-06-22 00:19:33 I personally would put that in the initialization word 2025-06-22 00:19:40 because that won't work if you compile this to flash 2025-06-22 00:19:44 true 2025-06-22 00:20:04 it's likely to crash things if you compile to flash actually 2025-06-22 00:20:15 Initialization word is the ugliest so far 2025-06-22 00:20:27 nah 2025-06-22 00:21:27 Im so so motivated right now 2025-06-22 00:22:11 what's a good symbol for append 2025-06-22 00:22:20 I'm having issue of event data overwriting other data lol 2025-06-22 00:22:45 use separate bits for each kind of data, as I originally did 2025-06-22 00:22:58 or use separate bytes for them 2025-06-22 00:23:14 I mean the name to call this :) 2025-06-22 00:23:18 event!+ ? 2025-06-22 00:23:24 separate bytes have some advantages in some case for atomicity 2025-06-22 00:23:28 lf94: oh, that's good! I didn't know that! 2025-06-22 00:23:33 that'd work 2025-06-22 00:27:44 Yep this is working great 2025-06-22 00:27:51 nice 2025-06-22 00:27:55 Tempted to go fix up my iambic paddle now 2025-06-22 00:27:59 even the timer is working 2025-06-22 00:28:16 -· -·· 2025-06-22 00:28:26 -·-·-·-·-· 2025-06-22 00:29:00 I can't tell if it's the pins being shitty or a logic error when placing the 2nd one on 2025-06-22 00:29:08 I can get both . and - to appear sequenced 2025-06-22 00:29:17 But it's like the timing matters? 2025-06-22 00:29:32 you're using one byte to store both values 2025-06-22 00:29:43 no no this is a diff issue 2025-06-22 00:29:52 if you have your rp2350 / rp2040 you'll see what I mena 2025-06-22 00:29:59 refresh the gist 2025-06-22 00:31:15 what exactly do you mean? 2025-06-22 00:31:34 it's not related to event! word 2025-06-22 00:31:37 it's something else 2025-06-22 00:32:24 what do you mean by "appear sequenced"? 2025-06-22 00:32:37 each character shows up one after the other at a fixed rate 2025-06-22 00:32:41 .-.-.-.-.- 2025-06-22 00:32:52 that's what I saw 2025-06-22 00:33:04 Right, but do you find it hard to like, make it happen? 2025-06-22 00:33:15 I find I have to almost time it for the 2nd character to start showing 2025-06-22 00:33:23 no, it was occurring constantly as soon as START was executed 2025-06-22 00:33:34 oh weird, not the case for me 2025-06-22 00:33:44 I'm talking about when you ground both 2025-06-22 00:35:29 paddle.request-check @ LEFT and if 2025-06-22 00:35:29 output.dot 2025-06-22 00:35:29 output.dash 2025-06-22 00:35:31 RIGHT paddle.request-check bic! 2025-06-22 00:35:33 then 2025-06-22 00:35:35 then 2025-06-22 00:35:42 you check one, unset it, then next time around you check the other, and unset that 2025-06-22 00:35:47 Yes 2025-06-22 00:35:51 That's right behavior 2025-06-22 00:36:00 and then when both are unset, it "resets" the request register 2025-06-22 00:36:33 so you're saying it's doing this continuously even though it's edge-triggered? 2025-06-22 00:36:38 Yep! 2025-06-22 00:36:51 That's behavior of an iambic paddle controlled by an electric keyer 2025-06-22 00:36:59 It sends out . and - at a fixed rate 2025-06-22 00:37:04 as you hold them down 2025-06-22 00:39:21 please explain for a second what exactly you're seeing 2025-06-22 00:39:31 tell me like I'm five :) 2025-06-22 00:39:40 tiny letters on a computer screen 2025-06-22 00:39:50 I'm seeing it's difficult to trigger - at the same time. 2025-06-22 00:39:59 It's possible, but seems ... hard 2025-06-22 00:40:18 You will see if you try on you rp 2025-06-22 00:41:14 try moving GPIO_PADDLE_LEFT INTR_GPIO_EDGE_LOW! inside the IF ... THEN 2025-06-22 00:41:26 so it is called only if the condition is detected 2025-06-22 00:41:44 so if there is a slight timing difference between the two signals it won't erroneously fail to detect one of them 2025-06-22 00:42:03 do it for all of those, btw 2025-06-22 00:42:30 ok 2025-06-22 00:43:45 I think that helped 2025-06-22 00:44:04 I can't tell if it's just me touching the pins too that's just...wonky 2025-06-22 00:44:08 I'm using 3 alligator clips 2025-06-22 00:44:20 One on ground, and then 2 attached the end of that one 2025-06-22 00:44:30 and then touching the 2 pins with the 2 non-alligator ends 2025-06-22 00:44:40 are you touching the metal parts 2025-06-22 00:44:47 Of course lol 2025-06-22 00:45:14 GND alligator-----pin alligators <===== pins 2025-06-22 00:45:22 hard to show in text lol 2025-06-22 00:45:42 then those 2 pins ===== gpio 14 and 15 2025-06-22 00:45:48 on header pins 2025-06-22 00:46:00 so it's like trying to touch 2 thin pieces of metal with 2 other pieces of metal 2025-06-22 00:46:08 thin metal* 2025-06-22 00:46:40 I don't think you're going to get decent signals this way 2025-06-22 00:47:00 lol 2025-06-22 00:47:07 Ok, I should maybe then bring out my paddle at this point 2025-06-22 00:47:10 and hook it up 2025-06-22 00:47:20 yeah 2025-06-22 00:47:53 : turnkey ... ; also right? for auto start? 2025-06-22 00:48:25 yeah 2025-06-22 01:10:07 Sorry, taking me some time to adjust the paddle 2025-06-22 01:10:12 I haven't adjusted it at all since I got it 2025-06-22 01:10:18 (Google "Bencher BY-1" :) 2025-06-22 01:10:40 (You pretty much made the cheapest electronic keyer money can buy :D) 2025-06-22 01:10:53 (That goes with these iambic paddles) 2025-06-22 01:10:59 (The paddle itself has zero electronics) 2025-06-22 01:11:33 ah 2025-06-22 01:11:58 Does the "left" and "right" and "paddles" make sense now? XD 2025-06-22 01:12:24 oh I figured they were buttons you pressed on the paddle to generate dots and dashes 2025-06-22 01:13:29 oh I see 2025-06-22 01:15:28 they're paddle-shaped buttons 2025-06-22 01:15:43 yeah 2025-06-22 01:16:00 you can move your hand left and right without moving your fingers relative to your hand in order to switch between dots and dashes 2025-06-22 01:16:10 except when you're doing the Iambic Squeeze 2025-06-22 01:16:40 the original version of the device was called a "bug", was purely mechanical, and did not support the Iambic Squeeze 2025-06-22 01:17:30 https://en.wikipedia.org/wiki/Vibroplex 2025-06-22 01:19:58 the iambic squeeze I presume involves literally squeezing both paddles together at once to generate a dot and then a dash? 2025-06-22 01:22:04 yeah, when both paddles are pressed, it alternates between dots and dashes 2025-06-22 01:22:09 yep! 2025-06-22 01:22:46 lf94: I suspect you could hook up a 4.91¢ NY8A054E as an iambic keyer: https://jlcpcb.com/partdetail/NyquestTech-NY8A054E/C5143690 2025-06-22 01:24:20 when you're involving sub-cup of coffee pricing, though, and you're not doing mass production... 2025-06-22 01:24:58 or a PMS150C, which is 2.6¢: https://jlcpcb.com/parts/2nd/Embedded_Processors_Controllers/Microcontrollers_(MCU_MPU_SOC)_2584 2025-06-22 01:25:19 oops, sorry 2025-06-22 01:25:26 oftentimes the tooling for those uber-cheap parts can be uber-expensive 2025-06-22 01:25:36 I mean https://jlcpcb.com/partdetail/PadaukTech-PMS150CS08/C129127 2025-06-22 01:25:46 Also, we've implemented our own software solution that'll work on literally anything 2025-06-22 01:25:49 custom programmers and ICE's and like 2025-06-22 01:26:12 It's Forth. I bet I could get this working on GBForth with little changes 2025-06-22 01:26:13 the PMS150C is well supported by free tooling, although it's an OTP part 2025-06-22 01:26:31 well the software would have to be adapted to run on anything other than an RP2040 (with minor modifications it should work on an RP2350) 2025-06-22 01:26:37 I could probably use the link cable port 2025-06-22 01:27:00 some of Forth's advantages would not really be in play on the PMS150C 2025-06-22 01:27:04 xentrac: what about the price of the programmer though 2025-06-22 01:27:32 ACTION tends to be skeptical of ultra-cheap microcontrollers himself 2025-06-22 01:28:11 there's a free programmer called "Free PDK programmer": https://free-pdk.github.io/ 2025-06-22 01:28:55 no, I mean the physical hardware 2025-06-22 01:29:05 yeah, that's what I'm talking about 2025-06-22 01:29:17 it's not free as in price, but as in open-source hardware 2025-06-22 01:30:08 you can get PCBWay to build it for you for US$27.76: https://www.pcbway.com/QuickOrderOnline.aspx?fileurl=https://processor-cdn.kitspace.org/v6/free-pdk/easy-pdk-programmer-hardware/9bb62c64328e3968737b244c970d66c3570f6f59/_/easy-pdk-programmer-hardware-9bb62c6-gerbers.zip&from=kitspace 2025-06-22 01:30:14 ah 2025-06-22 01:30:25 I thought you meant free programming software 2025-06-22 01:31:11 the NY8A054E is Nyquest's own weird 8-bit PIC-like architecture, and I don't think anything supports it 2025-06-22 01:31:39 also, why spend 27.76 on a device, even if it's oepn hardware, just so you can claim to have spent only $0.026 USD on the MCU itself 2025-06-22 01:31:45 if you're not doing mass production 2025-06-22 01:31:47 *open 2025-06-22 01:31:57 I've sometimes seen the NY8A051 family as cheap as 1.58¢ 2025-06-22 01:32:09 oh, because you want to build a device containing more than one computer 2025-06-22 01:32:51 but you're making an electronic keyer that will require only one MCU 2025-06-22 01:35:33 for a hello-world project, yeah 2025-06-22 01:36:08 also, such uber-cheap MCU's tend to be very limited 2025-06-22 01:36:57 when you can spend under $2 for an RP2350 and the corresponding Winbond QSPI flash chip... 2025-06-22 01:37:41 they're very limited indeed, yes 2025-06-22 01:37:56 transistors are also very limited 2025-06-22 01:38:06 but sometimes people use them in electronics designs anyway 2025-06-22 01:39:33 these microcontrollers are cheaper than not just discrete logic gates but even most discrete transistors (because they are smaller and can handle less power than the transistors) 2025-06-22 01:41:13 often people use soldering irons that cost more than US$28 to solder the discrete transistors to their boards, too ;) 2025-06-22 01:41:53 you're not going to sell me on Padauk or Nyquest ultra-cheap, very limited MCU's 2025-06-22 01:43:29 that's okay; maybe you don't do electronics 2025-06-22 01:44:44 like the Nyquest has a program memory (that's ROM not RAM) of *2K words* 2025-06-22 01:45:03 some of the Padauk microcontrollers have even less 2025-06-22 01:45:20 I think the smallest one is 512 words (and again PROM, not RAM or Flash) 2025-06-22 01:45:53 2K words of code is *nothing* 2025-06-22 01:46:13 I've written an HTTP server that's less instructions than that 2025-06-22 01:46:25 heh 2025-06-22 01:46:45 on Linux though 2025-06-22 01:46:46 I presume you used a separate ESP8285 or ESP32 chip to provide the networking 2025-06-22 01:46:54 2K words is way more than you need for your electric toothbrush or whatever else a lot of microcontrollers go into 2025-06-22 01:46:54 so it doesn't include the TCP/IP stack! 2025-06-22 01:46:57 which is kind of cheating here 2025-06-22 01:47:31 MrMobius: thing is, are we producing electric toothbrushes in the millions here? 2025-06-22 01:47:43 it's fun to cram a whole retrocomputer into a microcontroller but the vast majority of them never get used for anything like that 2025-06-22 01:47:52 don't think of them as alternatives to an RP2350. they aren't. they're alternatives to things like a 555 or an op-amp active filter or a video interface chip 2025-06-22 01:48:04 tabemann: I dont care. the point is, 2K words is not *nothing* as you said 2025-06-22 01:48:33 512 instructions is way more than enough to do what a 555 does 2025-06-22 01:49:52 (and without the external components the 555 needs) 2025-06-22 01:50:04 yeah, and you better get your code right before you produce a part, as otherwise you're going to have literally unsolder your chip and solder in a new one if the code ever needs to change 2025-06-22 01:50:08 ok! 2025-06-22 01:50:10 All adjusted 2025-06-22 01:50:12 hooking it up now 2025-06-22 01:50:30 but, like I said, maybe you don't do electronics, so you don't understand why someone would want that kind of thing 2025-06-22 01:50:58 I mean, literally unsoldering components and soldering in new ones is par for the course when your circuit has a design error? 2025-06-22 01:51:28 xentrac: it's just that I'm not looking for parts to replace 555's here 2025-06-22 01:51:43 sure, that 2 cent padauk chip may be more than adequate when you're replacing a 555 2025-06-22 01:52:26 xentrac: I appreciate being able to update code after something is assembled 2025-06-22 01:53:07 yeah, it's a definite plus 2025-06-22 01:54:46 this guy got the 2.6¢ PMS150C to recognize MNIST digits with 90% accuracy, supposedly: https://cpldcpu.com/2024/05/02/machine-learning-mnist-inference-on-the-3-cent-microcontroller/ 2025-06-22 01:55:04 running a neural network 2025-06-22 01:55:54 and several people have gotten them to generate the waveform needed to drive a string of WS2812 RGB LEDs 2025-06-22 02:02:04 Nice it works 2025-06-22 02:02:22 I think it'd work better with solid core wire? 2025-06-22 02:03:24 https://hackaday.com/2019/04/26/making-a-three-cent-microcontroller-useful/#comment-6145337 lists another use: 2025-06-22 02:03:40 > I had a problem with my wESP32 where the BD5228 I was using to sequence the Ethernet PHY reset wasn’t always working correctly (see https://www.crowdsupply.com/silicognition/wesp32/updates/the-phy-reset-saga). The PMS150C was perfect to fix this: writing the program was trivial, the micro fit where the old chip used to be and I could make it generate the exact signals I wanted. For significantly less 2025-06-22 02:03:46 than the price of the chip it was replacing, even factory programmed, it did exactly what I wanted it to do. 2025-06-22 02:05:30 in more detail: 2025-06-22 02:05:32 > There are plenty of supervisors that monitor multiple voltages and generate a reset, but I couldn’t find any low cost options that monitor one input and generate two reset signals with separate delays. 2025-06-22 02:06:00 now, plausibly this is not a problem you can relate to, which would explain why you think "2K words of code is *nothing*" 2025-06-22 02:07:12 but it's actually a pretty common sort of problem in electronics. when the specific problem you have is *so* common that TI makes a part that solves it for you out of the box, that's one thing. But often you're trying to solve a problem that's *almost*, but not exactly, like everybody else's problem 2025-06-22 02:08:44 Ok think I'm coming to the phase of this project where I solder some thicker wiring to this 2025-06-22 02:08:46 and longer wires 2025-06-22 02:10:00 " when you can spend under $2 for an RP2350 and the corresponding Winbond QSPI flash chip..." ... thats nonsense tabemann, youve left out the PCB cost and the assembly cost at the pcb fab, (such as JLCPCB) as SMT requires the correct tools and assembly, now because it's a pcb, what about the 3.3v regulator, caps etc ? 2025-06-22 02:11:29 Ok so I think there's a bug on release 2025-06-22 02:11:34 But we'll come back to that 2025-06-22 02:12:45 tabemann, youre another case of a programmer talking about stuff they have no practical experience with, especially comments such as " 2K words of code is *nothing*", thats more nonsense. 2K is heaps for many small embedded tasks when assembly is used (or Mecrisp-Across). Often less than 1K words is plenty 2025-06-22 02:13:58 oh shit 2025-06-22 02:14:18 tabemann: is it possible for the timer interrupt to be interrupted multiple times by a gpio interrupt before it fires, thus firing many times? 2025-06-22 02:14:44 tabemann, you have to actually start building and finishing small embedded projects, documenting them and showcasing them to the world to get some experience before you blather on about embedded as tho you actually have real experience, when you don't. 2025-06-22 02:15:58 tabemann did build a pretty awesome Forth though 2025-06-22 02:16:08 I should probably take your advice too, though, tpbsd 2025-06-22 02:16:27 Why don't you guys think he has the experience 2025-06-22 02:16:34 I think tabemann probably has a shit ton 2025-06-22 02:16:48 I think he has a shit-ton of experience with computers and none with electronics 2025-06-22 02:18:13 I don't have nearly as much experience with electronics as tpbsd, but easily enough experience to have run into electronics problems where a 3¢ or 5¢ programmable chip that will emit waveforms on cue would have made my life a lot easier 2025-06-22 02:19:24 he does, at programming 2025-06-22 02:19:53 but programming experience isnt hardware experience, don't confuse them 2025-06-22 02:20:19 Right, but I've not seen anything that would point them to being inexperienced here 2025-06-22 02:20:37 Other than not agreeing on some particular philosophy 2025-06-22 02:21:39 tpbsd: btw, where do you showcase your documented projects? 2025-06-22 02:25:36 lf94: it's not really a question of philosophy. if you've encountered problems like my reset-sequencing example above, or just about anything you'd use a 555 for, and you've solved them with discrete logic and timer and comparator chips, something like the PMS150C is just an obviously better solution, regardless of what your philosophy is. if those problems aren't part of your reference set, 2K words of 2025-06-22 02:25:42 code might seem like nothing to you 2025-06-22 02:26:47 basically, if you can't understand why someone would ever use a PMS150C, you can't understand why someone would ever use a transistor or a 555, because you haven't 2025-06-22 02:30:57 xentrac: is there a flash version of the same 3 cent chip? 2025-06-22 02:31:16 so you can flash one for testing and use the 3 cent chip when youre done 2025-06-22 02:33:25 yes, it's like 15¢ 2025-06-22 02:33:41 they also sell ICEs 2025-06-22 02:33:48 that would make me slightly more interested 2025-06-22 02:33:58 although documentation and community are the selling point 2025-06-22 02:36:14 MrMobius, the initial PADUAK 2c chips all disappeared when covid hit, they were OTP and the ICE plus flashing routine was proprietary. The ICE unit itself was around $1000 USD back then 2025-06-22 02:37:07 I've been impressed with Padauk's documentation, although I've read a lot of it in Chinese 2025-06-22 02:37:09 Will level low / high interrupts fire a lot 2025-06-22 02:37:23 community doesn't seem to exist 2025-06-22 02:37:29 MrMobius, many suspected that the series was just a experimental production of a few million units on old cheap FAB's and when they were all sold, that ws it 2025-06-22 02:37:45 yeah, but LCSC has them in stock now; see link above 2025-06-22 02:38:04 interesting 2025-06-22 02:40:20 those OTP's also had very few internal peripherals, and were 8 bit. At the same time they were selling I was buying MSP430 with 4KB FRAM, 16 bit and lots of internal peripherals for $0.20 each, I have about 2,000 in stock as a result 2025-06-22 02:40:31 I think it's true that they're using a trailing-edge process, which apparently TI has rebranded as "foundational semiconductors": https://www.ti.com/about-ti/newsroom/news-releases/2025/texas-instruments-plans-to-invest-more-than--60-billion-to-manufacture-billions-of-foundational-semiconductors-in-the-us.html 2025-06-22 02:41:07 because their power dissipation is pretty bad (high) 2025-06-22 02:41:33 whats more the MSP430 dont need a ICE as they are infinitely reprogrammable being FRAM and have JTAG for GDB 2025-06-22 02:41:37 I think doing these inputs on edge low/high is causing me problems 2025-06-22 02:41:57 the two-"core" versions of the chip are interesting in the "few internal peripherals" department, because you can program one of the "cores" to act as an internal peripheral 2025-06-22 02:42:18 you get faster response that way than you get with an interrupt handler on most chips 2025-06-22 02:42:32 infinitely reprogrammable is a pretty big plus 2025-06-22 02:44:15 they haven't determined the lifespan of FRAM yet as doing that would take years 2025-06-22 02:45:24 they've had years though 2025-06-22 02:46:26 https://en.wikipedia.org/wiki/Ferroelectric_RAM says the read/write (?) endurance is 10¹⁰ to 10¹⁵ cycles 2025-06-22 02:47:18 10¹⁰ cycles is only a few minutes, but maybe TI's chips don't fail that fast 2025-06-22 02:47:33 but even 10¹⁵ is only a couple of years 2025-06-22 02:47:48 (if you're testing by writing the same memory location repeatedly the entire time) 2025-06-22 02:50:45 I think TI was saying 10^13 at one point 2025-06-22 02:51:02 and removed the wording about "unlimited" at some point 2025-06-22 02:51:35 MrMobius, that rings a bell, but they also said that the test pieces hadnt failed at that point, they just got tired of waiting and stopped the test 2025-06-22 02:52:54 in any event the actual rewrite time was so high, it doesnt really matter what it is to all practical purposes 2025-06-22 02:53:10 right. unlimited for all practical purposes 2025-06-22 02:53:15 yeah 2025-06-22 02:53:37 anyone rewriting endlessly will use ram anyway 2025-06-22 02:53:56 it applies to reads to though right? 2025-06-22 02:55:03 well a read is the same as a write (iirc) in that a rewrite is needed immediately to refresh after the read, but this is taken care of internally to the FRAM chip 2025-06-22 02:55:24 it's transparent to the controlling mcu 2025-06-22 02:55:36 lf94, the GPIO interrupt can fire as many times as possible at any time 2025-06-22 02:55:53 if the priorities are set in a certain way they can even fire *during* the timer interrupt 2025-06-22 02:56:09 I think I may need to debounce 2025-06-22 02:56:17 you will 2025-06-22 02:56:24 what do you mean about the rewrite time being high? 2025-06-22 02:57:10 tabemann: Is a cheap way to do this like... simply only accept what happens in a short amount of time? or maybe average out the inputs? 2025-06-22 02:57:39 start o xxo o xo xo xo o xo o x_oxox_o x_xo xoxoo x_o x_o x_o x_xo x_ox_o x_ox_xo o xoox_o x_o xo o x_xo o xox_xoxo xox_xoo x_o xxo o x_o xxo xoxo xo xo x_xo o xoxo 2025-06-22 02:57:51 ^ raw edge inputs, x is fall, o is rise 2025-06-22 02:58:04 (_ is the system doing a dash lol) 2025-06-22 02:58:24 we can see pairs of xo canceling each other out 2025-06-22 02:58:59 lf94: probably the easiest way to do it is with the GPIO interrupt notifying a task, which implements the debounce 2025-06-22 02:59:11 You love your tasks B) 2025-06-22 02:59:16 Let's zoom into one part 2025-06-22 02:59:19 xxo 2025-06-22 02:59:39 Here, it did a "release" (space) right after, because o has some sorta output priority 2025-06-22 02:59:49 But it really shouldve interpreted this as an x 2025-06-22 03:01:03 basically you have the task wait on a notification, and then it waits for the signal to settle 2025-06-22 03:02:16 I'll be back later 2025-06-22 03:02:22 Maybe I should instead use edges as notifiers but levels as the actual value? 2025-06-22 03:02:25 ok! 2025-06-22 03:02:32 ideally it would read the button repeatedly and wait for it to stop oscillating rather than just waiting 2025-06-22 03:03:05 https://gist.github.com/lf94/95516fa39c3339b685e0fde10f17c97a 2025-06-22 03:03:11 This is my code so far MrMobius 2025-06-22 03:11:15 https://sev.dev/hardware/better-debounce-algorithms/ 2025-06-22 03:11:18 Going to implement this 2025-06-22 03:15:48 lf94: which one, StateShift or PingPong? 2025-06-22 03:15:56 PingPong I think 2025-06-22 03:16:11 MrMobius, Ive always set a delay after a button interrupt and then checked back at the end of the delay, usually around 20mS. if the logic level is the same, it means bouncing has stopped and the button has been pressed, otherwise it's ignored 2025-06-22 03:16:33 20ms is too long for an iambic keyer, but 1ms is probably fine 2025-06-22 03:16:40 https://github.com/sevmeyer/debounce-test 2025-06-22 03:16:46 This is really, really nice. 2025-06-22 03:17:11 I gotta say, my iambic paddle is actually quite good for bouncing, as you see from the output above 2025-06-22 03:17:29 < 6ms window should be more than enough 2025-06-22 03:17:38 6ms is probably still too long 2025-06-22 03:17:42 tpbsd: the problem with that is if it's still bouncing after 20ms you might catch it when the level is still the same but it's not done bouncing 2025-06-22 03:17:57 I feel like both of these algorithms are making things harder than they need to because they're worried about noise. I don't think you're going to have noise, just bouncing 2025-06-22 03:18:11 https://github.com/sevmeyer/debounce-test/blob/master/src/test-evenodd.c so simple 2025-06-22 03:18:18 lf94: where's the output above? 2025-06-22 03:18:34 xentrac: look for x's and o's 2025-06-22 03:18:47 oh, I saw that but I don't know how to interpret it. what's the timescale? 2025-06-22 03:19:33 Hard to articulate 2025-06-22 03:19:47 But if you see xxo it's literally like < 30ms 2025-06-22 03:19:57 30ms is a very, very long time 2025-06-22 03:20:10 probably less then, it's from me tapping the key 2025-06-22 03:20:18 not mechanically speaning it isnt 2025-06-22 03:20:30 Google "Bencher BY-1" 2025-06-22 03:20:38 30ms is a very, very FAST time, mechanically speaking 2025-06-22 03:20:38 I'm like tapping the top of the triangle 2025-06-22 03:21:01 it's only very fast 'electronically' speaking 2025-06-22 03:21:29 it's a very long time in terms of morse code keying latencies 2025-06-22 03:21:35 the linked Jack Ganssle page https://www.ganssle.com/debouncing.htm has some scope waveforms of different switches bouncing 2025-06-22 03:22:31 Ive tested many pushbuttons myself going back 40 years, I hardly need a Ganssle chart of the same thing 2025-06-22 03:22:38 he says of his tests: "Toss out those two samples and the other 16 switches exhibited an average 1557 µsec of bouncing, with, as I said, a max of 6200 µsec." 2025-06-22 03:23:12 but he also had a button that bounced for 150+ milliseconds 2025-06-22 03:23:20 then there is the range of bouncing exhibited by identical pushbuttons of the same model 2025-06-22 03:23:22 which would be unusable for purposes like this 2025-06-22 03:23:56 but a lot of them were reliably sub-millisecond 2025-06-22 03:24:26 for an iambic keyer you often have to time your switch closings and openings to within three dit times 2025-06-22 03:25:36 xentrac, hardly important for most push buttons as people are very slow and 20ms is fine in general 2025-06-22 03:26:31 20ms is not, in any way, fine: https://danluu.com/keyboard-latency/#appendix-counter-arguments-to-common-arguments-that-latency-doesn-t-matter 2025-06-22 03:26:44 specialist cases such as the 'iambic' keyer will need fine tuning but theyre the exception to key debounce, not the rule 2025-06-22 03:27:36 actually a better link is https://danluu.com/input-lag/#appendix-why-measure-latency 2025-06-22 03:27:53 > Latency matters! For very simple tasks, people can perceive latencies down to 2 ms or less. Moreover, increasing latency is not only noticeable to users, it causes users to execute simple tasks less accurately. If you want a visual demonstration of what latency looks like and you don’t have a super-fast old computer lying around, check out this MSR demo on touchscreen latency. 2025-06-22 03:28:29 the links being https://pdfs.semanticscholar.org/386a/15fd85c162b8e4ebb6023acdce9df2bd43ee.pdf (can perceive), http://www.tactuallabs.com/papers/howMuchFasterIsFastEnoughCHI15.pdf (less accurately), and https://www.youtube.com/watch?v=vOvQCPLkPt4 (MSR demo) 2025-06-22 03:28:38 xentrac, you love to argue about anything don't you ? and as long as you have enough links you can go all day. What happens when you actually have to speak from experience, are you struck dumb ? 2025-06-22 03:29:08 xentrac, have you ever measured the bouncing of a switch yourself ? 2025-06-22 03:29:49 I do tend to be fairly argumentative. I understand I'm not going to educate *you* but other people may be reading the conversation and profit from the links. 2025-06-22 03:30:08 Yes, I've measured the bouncing of switches, but it's been decades. 2025-06-22 03:30:36 http://0x0.st/8IYD.jpg 2025-06-22 03:30:39 http://0x0.st/8IYk.jpg 2025-06-22 03:30:43 For some visuals 2025-06-22 03:30:45 :) 2025-06-22 03:30:55 I hardly need a education from trolls like you I document my switch debouncing: https://mecrisp-stellaris-folkdoc.sourceforge.io/_images/quadrature-switch-delayed-pic-2.png 2025-06-22 03:31:14 and https://mecrisp-stellaris-folkdoc.sourceforge.io/_images/quadrature-mech-enc-switch-4.png 2025-06-22 03:31:23 This whole setup is so stupid beautiful. 2025-06-22 03:31:42 thats hot of my scope and the switch Im debouncing is a rotary switch 2025-06-22 03:31:44 lf94: it is! 2025-06-22 03:32:04 read about it all here 2025-06-22 03:32:04 Knowing it's forth on the rp2040 makes my brain explode 2025-06-22 03:32:07 https://mecrisp-stellaris-folkdoc.sourceforge.io/quadrature-rotary-switch.html 2025-06-22 03:32:36 tpbsd: what's the timescale? 9.8 milliseconds per division seems implausible 2025-06-22 03:32:50 The ultimate would be a RP2040 _inside a USB cable 2025-06-22 03:33:09 Where it has like 10 wires 2025-06-22 03:33:14 hooked up to GPIOs 2025-06-22 03:33:16 that you can use 2025-06-22 03:33:43 I'm a dummy I can do that today 2025-06-22 03:33:54 I can make this tiny USB device look like one end 2025-06-22 03:34:04 lf94: have you measured the bounce times of your paddles? 2025-06-22 03:34:13 I dont even know where I'd start 2025-06-22 03:34:21 do you have an oscilloscope? 2025-06-22 03:34:24 no :( 2025-06-22 03:34:26 I want one though 2025-06-22 03:34:30 some day 2025-06-22 03:34:33 maybe use your sound card 2025-06-22 03:34:50 good idea 2025-06-22 03:34:55 with like 1 volt 2025-06-22 03:35:03 or less 2025-06-22 03:35:17 Can't I directly hook this up to the mic port 2025-06-22 03:35:26 and the friction itself will cause little blips 2025-06-22 03:35:35 "this"? 2025-06-22 03:35:37 the paddle 2025-06-22 03:36:04 (rp2040 obv. not involved at all in this) 2025-06-22 03:36:23 ...let me implement the debouncer first. 2025-06-22 03:36:26 I forget how much phantom power is 2025-06-22 03:36:31 Because this is still cool 2025-06-22 03:36:34 a cool idea I want to try 2025-06-22 03:36:38 maybe? 2025-06-22 03:36:46 maybe what 2025-06-22 03:37:05 maybe you can directly hook up the paddles to the mic port without a separate power source 2025-06-22 03:38:07 xentrac, it's what you read, the scope doesnt lie 2025-06-22 03:38:07 lf94: you might try asking in ##electronics 2025-06-22 03:38:25 I'm just gonna do it 2025-06-22 03:38:27 for science 2025-06-22 03:38:27 tpbsd: the scope's output is inadequately labeled to interpret 2025-06-22 03:38:29 lol 2025-06-22 03:40:12 I'm going to bed 2025-06-22 03:40:26 goodnight! and don't blow up your motherboard by connecting multiple volts to the mic input 2025-06-22 03:43:38 lol 2025-06-22 03:43:41 night 2025-06-22 03:44:23 tpbsd: Jack Ganssle's oscilloscope traces are labeled so I can tell what they're saying. Yours aren't 2025-06-22 03:44:33 What cheap scope do you guys recommend 2025-06-22 03:44:38 or even mid tier I guess 2025-06-22 03:55:19 xentrac, learn to read a scope then ? 2025-06-22 03:55:44 xentrac, ok, so you can't read a scope, why am I not surprised ? 2025-06-22 04:04:36 lf94: I have one of these and like it https://hantek.com/products/detail/13174 2025-06-22 04:04:44 but mostly use the multimeter part 2025-06-22 04:14:15 lf94, I have 3 scopes, a Tek 3904 analog storage mainframe with DSO plugin, thats reserved for specialist instances, and my main scope is a HP54601 DSO (https://www.youtube.com/watch?v=Je-y-tE1J4w) used to make the waveforms I pasted the URL's for above. I paid $4600 AUD for it new in 1994 and it's still going :) 2025-06-22 04:15:31 oops Tek7623A mainframe 2025-06-22 04:16:19 lf94, these days there are so many scopes to choose from, mainly chinese, the RIGOL brand is pretty good and very cheap compared to my old HP 2025-06-22 04:16:51 as are all the Hantek units, which are cheaper as they use a local PC to display the video 2025-06-22 04:35:07 My thinkpad is always around me when hacking, so that sounds nice. 2025-06-22 04:36:58 lf94, https://hantek.com/products/detail/13174 might be the one for you then ! 2025-06-22 04:38:26 tpbsd: you mean recording video or something? the scope functionality works in real time 2025-06-22 04:40:07 MrMobius, no I only mean the display for the waveform etc, as that unit doesnt have a display does it ? 2025-06-22 04:40:22 oops! 2025-06-22 04:40:27 my BAD! 2025-06-22 04:40:37 I see it does have a small lcd display 2025-06-22 04:40:48 it's not bad actually 2025-06-22 04:41:38 sorry, I assumed it was just a box with a couple of BNC probe connectors and a USB out 2025-06-22 04:41:42 Wow - so small! 2025-06-22 04:41:55 like the early hanteks 2025-06-22 04:43:07 lf94, if MrMobius has one you know it's going to be pretty good! 2025-06-22 04:43:25 Nice. 2025-06-22 04:43:29 Price is very good too 2025-06-22 04:43:31 256 2025-06-22 04:43:33 CAD 2025-06-22 04:46:09 it looks perfect to start with 2025-06-22 04:46:33 and maybe to finish with depending how far you go 2025-06-22 15:04:04 xentrac: that's exactly what I was looking for yeah 2025-06-22 15:04:07 thanks 2025-06-22 18:51:21 tabemann: so my issue with debouncing is... I'm not using a timed window to check for it. 2025-06-22 18:51:40 I really like what one Reddit user described: use the edge rise/fall as the start of the timer window. 2025-06-22 18:51:44 I'll do this later 2025-06-22 18:52:06 I implemented the EvenOdd and PingPong algorithms but they're useless without this polling window :) 2025-06-22 19:38:57 nmz: happy to help! 2025-06-22 19:49:29 lf94: your sound card is fine for measuring time intervals down to about 30μs though, so it's fine for measuring switch bounce. where it falls down is faster signals (an entry-level oscilloscope has 20MHz of bandwidth instead of 20kHz) and any kind of absolute measurement 2025-06-22 19:49:52 you can use any audio editor such as Audacity to see the waveforms 2025-06-22 19:50:56 it sucks at absolute measurement because the input is not calibrated to absolute voltages, because its analog filtering induces some phase shift at more than a few kHz (though some sound cards can be quite good at this), and because the input is ac-coupled 2025-06-22 19:51:10 so you can't tell 5V dc from 0V dc 2025-06-22 20:09:21 back 2025-06-22 20:20:42 by "absolute measurement" I mean "absolute voltage measurement". it's fine for absolute duration measurement