-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] LPC1768 ZONESTAR ADC KEYPAD SKR V1.3 #14552
Comments
Update Looks like you need to specify the ADC channel rather than the pin, it's a remnant of how Arduino has analog pins and digital pins numbered the same and should probably be cleaned up, P1_30 would be analog channel 4. Glad you knew about the ADCs not being 5V tolerant or you would have damaged your board but I'm not sure how well this will function. |
Thanks for the info, i have donne some arduino programming, but marlin is a big project, lots of code and i get lost quickly. I will dig in to your perspective. Thanks! |
Same problem here. |
The LPC176x is 5V tolerant on all pins unless they are configured as ADC so there are no 5V analogue pins on any LPC176x board, connecting 5V while in ADC mode will break it. The pins files use the channel number not the pin number.
|
So now we have verified the reset was caused by the invalid pin, (I'l have to look at mitigation for that), to make the buttons work you are probably going to have to reduce the adc low pass filter https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.0.x/Marlin/src/HAL/HAL_LPC1768/HAL.h#L136, (try a value of 2) or it will change slowly between states (I'm going to change the default level of filtering soon)
The SERIAL_ECHO should output data over serial? |
no change, with the lowpass i wan to point out that if no key is pressed you get 3.3V on the analog pin. #if HAS_ADC_BUTTONS
static unsigned int raw_ADCKey_value =0 ;
static bool ADCKey_pressed = false;
#endif that 0 should be the max value for the ADC no? |
Hi, sorry to interrupt the discussion but @istyszy can you describe exactly how the SKR V1.3 rebooted before you made the changes to remove the reference to pin P1_30 as the ADC_KEYPAD_PIN? Did the system just halt or did it reboot over and over again? I've been talking to @p3p about this sort of issue earlier today and it would help us to better understand a problem seen by some other Marlin users. |
The value the variable is initialised to shouldn't be an issue. |
@gloomyandy @p3p Sorry for the delay had some things to do. |
Hi! It looks like initialization is missing for the adc keypad pin, I made necessary changes in my repository, #if ENABLED(ZONESTAR_LCD)
...
#define ADC_KEYPAD_PIN 4
... This configuration works for me. Things to do: ADC low pass filter needs to be disabled or adjusted somehow for the ADC keypad, otherwise it makes keys sluggish. For |
I will try toight. Thanks |
@Pavel4e5 You are right, started working but it has delays and then multiple presses... works strange. |
These delays and multiple presses occur because the low pass filter makes signal transients more gradual. |
@Pavel4e5 The only thing that needs to change is |
@p3p I checked these settings once again with a clean build, as you suggested. Here are the results: With ADC_LOWPASS_K_VALUE = 6 keypad unusable, with 1 it works almost ok, but from time to time it misses fast keypress. If I set ADC_LOWPASS_K_VALUE and ADC_MEDIAN_FILTER_SIZE to 0, then keypad works perfectly, like on the 8bit boards, but this turns off filtering altogether. |
I would only turns the LPF off, the median filter is considerably more important. These filters were added to try and compensate for people coming from AVR based printers with.. lets say less than acceptable wiring (there was a lot of reports). As long as your printers temperature readings are fine when printing there is no problem with disabling it so you can use this keypad. There is a hardware issue with the LPC176x mcu themselves that means some level of median filtering is required so you should not completely disable that, its unlikely to cause 2 consecutive bad reads so a I'm currently testing changing the LPF to 2 by default, unfortunately I don't have a printer with dodgy wiring ;) so it's hard to test. |
I will try tinkering with the settings. @p3p, thanks for explaining things to the new contributors! |
I will test for you but i have some other problems. Maybe in the weekend. |
I started working on enabling ZONESTAR_LCD for my SKR v1.3 board as well. Only after I made the same mistake as @istyszy (specifying the pin instead of ADC channel) I came across this issue. I have a slightly different pin assignment. I like it because it's the same as the LCD pinout, just mirrored horizontally. In my opinion, it made creating an adapter cable much easier:
|
Could you please provide more details on how to do this? Which pin is the ADC power source? I have a LCD from Anet A8 which I am trying to connect to SKR v1.3. So far I only get dim flashes on the lcd. |
@MikRoscope Here is a schematic of the display: https://i.imgur.com/DIEwA4i.png
|
Thanks a lot! I added a voltage regulator (and a switch to maintain 5V mode when needed https://imgur.com/a/R2ed44E). I also made a terrifying adapter (https://imgur.com/a/58mBi5B) to mirror the connection since my Anet A8 LCD had pin-out similar to yours. The LCD is now working and shows the usual text (https://imgur.com/a/CrQD6S5). However, pressing the buttons has no effect. I cant find where the changes in ADC_KEYPAD_PIN voltage is coded to represent menu actions. Edit: Using |
Ok, I got it working. To summarize, I added #if ENABLED(ZONESTAR_LCD) in \src\pins\pins_BIGTREE_SKR_V1.3.h. Then modifying The menu does not have any SDCard item. Is that normal? How can I print from stored GCode? |
In the config file you can enable sd-support
…On Sun, Jul 21, 2019, 2:43 PM MikRoscope ***@***.***> wrote:
Ok, I got it working. To summarize, I added
#if HAS_ADC_BUTTONS
HAL_ANALOG_SELECT(ADC_KEYPAD_PIN);
#endif
to /src/module/temperature.cpp as @Pavel4e5 <https://github.com/Pavel4e5>
mentioned. Physically mirroring the connection as @powertomato
<https://github.com/powertomato> explained and this pin configuration
#if ENABLED(ZONESTAR_LCD)
#define LCD_PINS_RS P1_20
#define LCD_PINS_ENABLE P1_18
#define LCD_PINS_D4 P1_23
#define LCD_PINS_D5 P1_21
#define LCD_PINS_D6 P1_19
#define LCD_PINS_D7 P0_28
#define ADC_KEYPAD_PIN 4
#endif
in \src\pins\pins_BIGTREE_SKR_V1.3.h. Then modifying
#define ADC_MEDIAN_FILTER_SIZE (2)
#define ADC_LOWPASS_K_VALUE (2)
in \src\HAL\HAL_LPC1768\HAL.h.
The menu does not have any SDCard item. Is that normal? How can I print
from stored GCode?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14552?email_source=notifications&email_token=AJOV4CR37ZOHFA5S2SY4H4TQARDVTA5CNFSM4H7BWAUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2OBR3A#issuecomment-513546476>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJOV4CUH7PSWN46MIN4TNO3QARDVTANCNFSM4H7BWAUA>
.
|
Ok, Where did you place #if HAS_ADC_BUTTONS |
#14552 (comment) |
@atreubig49 @istyszy it is actually already merged upstream, if you download the latest nightly (or pull the changes if you cloned the repository) it should already be there. I finally got around to fiddle with the filter settings and can confirm
works for me. |
nice to see another one solved, @istyszy can you confirm? |
Yes, zonestar lcd is working ! |
oki, will close then :-D |
As happy as I am that the ADC keypads work when converted to 3.3V, I'm worried people will see that they are "supported" and start just plugging them in which will cause damage to the LPC176x MCU ADC channels. I'm not sure where this can be documented so users see the compatibility issue before trying it out and look into it after its too late. |
@p3p I was thinking about that, as I originally planned to create a pull request, but decided against it for that exact reason. These were my thoughs on how one could fool-proof it a bit: LPC176xs ADC pins are only 5V intolerant if configured as ADC. So the damage will only occur if the users actively configure the pin as ADC i.e. define ADC_KEYPAD_PIN otherwise a compile error would occur. One could catch that from happening and show a more meaningful compile error. Something like: --- a/Marlin/src/module/temperature.cpp
+++ b/Marlin/src/module/temperature.cpp
@@ -1685,6 +1685,12 @@ void Temperature::init() {
HAL_ANALOG_SELECT(FILWIDTH_PIN);
#endif
#if HAS_ADC_BUTTONS
+ #ifndef ADC_KEYPAD_PIN
+ #error WARNING: ADC-keypads REQUIRE a hardware modification on 3.3V devices and are \
+ not officialy supported. As ADC_KEYPAD_PIN not defined, most likely you're on \
+ a 3.3V device. Only proceed if you know what you are doing or you will damage \
+ your board!
+ #endif
HAL_ANALOG_SELECT(ADC_KEYPAD_PIN);
#endif One can only hope that people know the risks if they start fiddling with the pin-settings by themself. But even for those who don't, HAS_ADC_BUTTONS could be redefined to something like In any way I would label this issue as "wont fix", that implies there is some work required to get these displays to work. |
Your approach is also great but i think people who thinker around to rewire the display
Anyway there should be a place where you can find mods and documentation on this subject. |
I am having same issue, trying make Anet A8 display work on SKR V1.3. Display is functional but keys are not. I am thinking of two approaches:
I am curious would these approaches work, and which one would be better? |
@mmrvelj I went with #1 without desoldering R7. On my unit (might be different on others) the 5V line is quite long and wide. Enough to cut it and scratch away the soldermask on the two ends then solder Vin and Vout of an SMD voltage regulator. As for GND I chose a regulator that has a heatsink connected to GND (LM7833), I scratched away some of the soldermask on the GND-plane and solderd it to that. |
@powertomato thanks for the feedback. I went also with option 1 as it looked safer. Here is the picture of my setup and I also confirm that the approach works. It requires changes mentioned by @MikRoscope and others Module is the one I had laying around identical to this one. After I removed black plastic distancer from the module and bent pins in order to make everything flatter, I also desoldered LED that would otherwise be on all the time. I had to put different SMD resistor (on the leg OUT), because I lost the original one (it flew away somewhere :) ), the replacement I had is a bit smaller in size (also 4.7k). |
I should probably mention here that the original pin assignment issue has been fixed, so you should now use the pin number (Px_xx) not the adc channel number when setting the |
@milkpirate @powertomato Hey guys, so I'm pretty darn tired writing this, but I just ran into this issue trying to get my anet a plus back up and running. It looks like the a8 plus uses a different board design to the one that you guys have, and has quite a few resistors unpopulated. One thing I'm not totally clear on @milkpirate , are those two surface mount resistors you added on the only change that needs to be made with the pin assignments now changed? Ideally I'd like to use the original cables as I have no IDC connectors on hand to make modifications. edit: So one thing I think is different to your boards is that you guys have the five buttons, however I have the jogwheel that you can click, along with a reset button. edit 2 actually I think this thread isn't applicable to me at all, and I just have to do a bunch of rewiring (unfortunately seems like more work) |
Hello! @milkpirate I made the change that you suggested with the voltage divider, but I can't make anything appear on the display, the printer is ok and apparently the problem is in the cable, because I changed all the parameters mentioned. Could any of you give me a "how to for dummies"? |
@XOIIO @antonvier modification on the board itself: yes (higher values are better, keep the ratio). sadly this isnt all I had to do. the cable pinout needed a modification as well: I had to swap every other pin on one connector: But I still had a lot of trouble with missed button presses... so I stopped and went for another display board. |
thank's a lot @milkpirate! |
I did the manipulation but I have an error in marlin : |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
So after hitting a brick wall with I2C Display (for now) i figured out i try with Anet A8 LCD (aka zone-star) Got the wires hooked up on EXP1 (SKR V1.3) :
The result is that the MCU reboots in like 5 seconds when the ADC keypad function in activated in the firmware. Below are some compilation errors .
does anybody have an idea on this topic?
The text was updated successfully, but these errors were encountered: