FantomXR Posted February 20, 2020 Report Posted February 20, 2020 (edited) Hey people, I have a strange problem. I have a PCB with 9 encoders. This PCB is connected to another PCB with 27 switches. In total there are 8 SR. 4 on the button-PCB and 4 on the encoder PCB. Everything works fine except the very last encoder. The encoder is connected to pin4 and pin5 of the HC165. MIOS Studio shows fine that it toggles input 62 and 63 and depending on the direction the encoder is moved, either 62 or 63 will get triggered first. So this seems to be correct. In the NGC I wrote ENC n=9 sr=8 pins=6:5 type=detented1 But for some reason NG doesn't take those events as encoder events. This is the output of the terminal: [1406781.497] MBNG_DIN_NotifyToggle(62, 1) [1406781.497] No event assigned to BUTTON hw_id=62 [1406781.503] MBNG_DIN_NotifyToggle(63, 1) [1406781.503] No event assigned to BUTTON hw_id=63 [1406781.654] MBNG_DIN_NotifyToggle(62, 0) [1406781.654] No event assigned to BUTTON hw_id=62 [1406781.662] MBNG_DIN_NotifyToggle(63, 0) [1406781.662] No event assigned to BUTTON hw_id=63 But it should like this (just with another id though): [1406866.814] MBNG_ENC_NotifyChange(7, 1) [1406866.814] No event assigned to ENC hw_id=7 [1406867.121] MBNG_ENC_NotifyChange(7, 1) [1406867.121] No event assigned to ENC hw_id=7 [1406867.446] MBNG_ENC_NotifyChange(7, 1) [1406867.446] No event assigned to ENC hw_id=7 [1406867.747] MBNG_ENC_NotifyChange(7, 1) [1406867.747] No event assigned to ENC hw_id=7 Any ideas? I use the stock NG-firmware for this test. I've also tested to set pins=6:5 to all another combination like 4:5, 6:7, etc. But none of them works. Thank you very much! Best, Chris Edited February 20, 2020 by FantomXR Quote
FantomXR Posted February 20, 2020 Author Report Posted February 20, 2020 I just see that MIOS Studio gives me an error message: [1416035.046] [MBNG_FILE_C:303] ERROR: invalid pins for ENC n=9 ... pins=5 [1416035.046] [MBNG_FILE_C:303] (expecting 0:1, 1:0, 2:3, 3:2, 4:5, 5:4, 6:7 or 7:6) I thought that this isn't relevant. So it seems I need to change the wiring :-( btw.: @TK. I can not find the code for the different detented-types in the firmware. In which file are they defined? I ask because it seems that my encoders don't work properly. I use PEC11L from Bourns:https://www.bourns.com/PDFs/pec11l.pdf I use them in relative mode. CW 1, CCW 127. When turning fast CW I also get 127 from now to then. So it seems to bounce... Quote
Phatline Posted February 20, 2020 Report Posted February 20, 2020 (edited) cant speak for MB NG... but http://www.midibox.org/mios32/manual/mios32__enc_8h.html#aee5965aaa49ffc200ccb21763546635c && http://www.midibox.org/mios32/manual/group___m_i_o_s32___e_n_c.html#gac8d4a1c02157a171de0059047a99c815 Quote DISABLED NON_DETENTED DETENTED1 DETENTED2 DETENTED3 DETENTED4 DETENTED5 found in /home/inet-stick/midibox/mios32/trunk/mios32/common/mios32_enc.c how many pulses a detended type have? i remember in the forum there was a question about alps types... cant find it right now... Edited February 20, 2020 by Phatline Quote
FantomXR Posted February 21, 2020 Author Report Posted February 21, 2020 Hm, thanks for your help. Detented5 seems to work best. But not perfect though. Still it's jumping from now to then. But there must be some kind of code where those detent-modes are defined. And I can't find it. Quote
ssp Posted February 21, 2020 Report Posted February 21, 2020 Some of mine were jittery as hell. I opened them up and cleaned them with isopropyl and the brass contacts. There was far too much grease in them. All good now with a tiny bit of Teflon grease at the shaft point. No more jitters Quote
Hawkeye Posted February 21, 2020 Report Posted February 21, 2020 7 hours ago, FantomXR said: Hm, thanks for your help. Detented5 seems to work best. But not perfect though. Still it's jumping from now to then. But there must be some kind of code where those detent-modes are defined. And I can't find it. Take a look in mios32/common/mios32_enc.c - the "state machine" code is in MIOS32_ENC_UpdateStates(), there you should find the logic. You could also try to swap around pins 2 and 3 of the encoder, had to do this a while back for smaller 12mm ALPS encoders to work properly, otherwise would observe random jumps, back then the wiring was incorrect, as i installed 12mm Alps STEC encoders in 16mm encoder slots :). Have a good weekend! Peter Quote
FantomXR Posted February 21, 2020 Author Report Posted February 21, 2020 33 minutes ago, Hawkeye said: Take a look in mios32/common/mios32_enc.c - the "state machine" code is in MIOS32_ENC_UpdateStates(), there you should find the logic. You could also try to swap around pins 2 and 3 of the encoder, had to do this a while back for smaller 12mm ALPS encoders to work properly, otherwise would observe random jumps, back then the wiring was incorrect, as i installed 12mm Alps STEC encoders in 16mm encoder slots :). Have a good weekend! Peter Well that is due to a different pinout if STEC12 and 16. On 12 the C terminal is in the middle while it's on the outside on 16 iirc. I'll check again and report back. Quote
FantomXR Posted February 21, 2020 Author Report Posted February 21, 2020 I think I'll try to add capacitors to pins A and B since this is the fastest fix I could do. In the long run I'll change the layout, adding caps to ground and two 10k resistors as in the datasheet + 74HC14 to create nice and sharp results. Quote
FantomXR Posted March 4, 2020 Author Report Posted March 4, 2020 Alright. PCBs in the making. I'll hopefully receive them soon. I'll post the results. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.