Welcome! Log In Create A New Profile

Advanced

EC11 encoder configuration issue

Posted by lmcbmai 
EC11 encoder configuration issue
April 06, 2022 11:56AM
I am upgrading Velleman Vertex K8400 printer and replacing original 8-bit motherboard (3Drag Controller) with BTT SKR2.The original firmware was Marlin version 1.4. On SKR2 I will be running the latest 2.0.9.3. The printer has LCD display (4 lines, 20 characters) with EC11 encoder. I was able to find all the right pins to connect LCD to SKR board's EXT1 and EXT2 connectors. LCD works fine, reset button and encoder's push button work as well. The only thing I am having trouble with is encoder wheel. It worked with the old motherboard and it works on a test stand with Arduino Nano, so this is not encoder or wiring problem.

In the old firmware LCD was defined as ULTIMAKERCONTROLLER that would then define ULTIPANEL and NEWPANEL. In new Marlin version I have it defined as ULTIPANEL. BTN_EN1 translates into PE7 and BTN_EN2 translates into PB2 as they should. I can get into the menu by pushing encoder button but I cannot move up or down. I have tried pretty much everything I could think of including different encoder settings in configuration.h file but no luck.

The schematics on the encoder board is attached.

Has anyone experienced the same? Could you suggest what else to try to resolve this ?

Thanks
Attachments:
open | download - LCD_P8401_schematics.jpg (239.9 KB)
Re: EC11 encoder configuration issue
April 07, 2022 12:35AM
Try using the M43 command to watch the BTN_EN1 (PE7) and BTN_EN2 (PB2) pins/signals. It's a bit tricky but with some playing around you should be able to tell if they're toggling

First try M43 with a known good signal like BTN_ENC. Once you can see it toggling you know you're using M43 correctly.

I'd suggest first trying M43. It'll show all known pins. When you get tired of searching through the list try M43 Pxxx where xxx is the pin number. I don't have a STM32 system, so you'll need to experiment as to the layout of the pin number.

I have a different LCD than you so this may not apply but ... I had to play with the encoder position to see a state change in BTN_EN1 and BTN_EN2. The resting state was always high, so I ended up holding the knob between positions and eventually saw the state changes.

The M43 W Pxxx command will scan a single pin and reports when it sees a change. Unfortunately, this also kills all further commands to the controller so you'll need to reset it to try another pin. For me this caught some of the transitions. On one pin it made a difference if I was rotating one direction or the other as to if I saw something.

Below is an example from my LPC1768 system:

Send: M43 W P326
Recv: Watching pins
Recv: PIN: P3_26        BTN_EN1
Recv: PIN: P3_26        BTN_EN1
Re: EC11 encoder configuration issue
April 08, 2022 12:34AM
Many thanks for your reply! It was very helpful. thumbs up

After running several tests with M43 and came to the conclusion that I need to change the initial state of pins BTN_EN1 and BTN_EN2 from PULLUP to PULLDOWN.

Now my problem is - I don't know where to do it. The only place I was able to find where these pins are set to PULLUP is around line 400 in marlinui.cpp file, however replacing there SET_INPUT_PULLUP with SET_INPUT_PULLDOWN had no effect. After powering printer on M43 still shows pin states as Input = 1.

Recv: PIN: PE7 M42 P71 BTN_EN1 Input = 1
Recv: PIN: PB2 M42 P18 BTN_EN2 Input = 1

In the worst case, I can remove 10K resistors from PCB that will disconnect encoder from +5V, but I'd prefer making change in firmware rather than messing up with LCD board.


Thanks
Re: EC11 encoder configuration issue
April 08, 2022 12:59AM
According to the schematics above the encoder gnds the pins, so that would require a pull up, not a pull down.

Edited 1 time(s). Last edit at 04/08/2022 01:00AM by Dust.
Re: EC11 encoder configuration issue
April 08, 2022 02:52AM
As per drawing (old) CPU pins are PH0 and PH1 while encoder is connected to PH0E and PH1E. There are 10K resistors between those pins, so encoder grounds CPU pin not directly but via 10K.

As per STM32F429 datasheet CPU's own pull-up resistor is typically 10K, but may have minimum value of 7K. In either case, grounding via 10K is obviously not enough to flip the signal. When I ground CPU pin directly without resistor it works. Ideally I should disable both pull-up and pull-down on CPU pins and use the resistors from encoder, but I'm unsure if that is possible.
Re: EC11 encoder configuration issue
April 08, 2022 05:57PM
Tested with another unused pin that has pull-down set by default, but it did not work either.

Ended up shortening resistors R3 and R5 and that solved the problem.

Thanks again for your suggestions.
Re: EC11 encoder configuration issue
April 08, 2022 08:35PM
Try defining your LCD as a REPRAP_DISCOUNT_SMART_CONTROLLER. It's a 4x20 display.

I hooked one up to a BTT SKR pro 1.1 and it functioned perfectly. Just used the standard 10 pin cables.

I also was able to see BTN_EN1 and BTN_EN2 change states by just entering M43 W and twirling the knob both directions. The beeper was always on but it was an easy way to see if anything is happening.
>>> m43 w
SENDING:M43 W
Watching pins
PIN: PF11        M42 P93          BTN_EN2
PIN: PG10        M42 P108         BTN_EN1
PIN: PF11        M42 P93          BTN_EN2
PIN: PG10        M42 P108         BTN_EN1
Re: EC11 encoder configuration issue
April 09, 2022 08:03AM
Glad you got it working.

Please disregard my previous post. I hadn't read your success post before I hit send.
Re: EC11 encoder configuration issue
April 10, 2022 11:46PM
Thanks for your reply. Yes, I ended up fixing the issue on hardware level.
Sorry, only registered users may post in this forum.

Click here to login