Mega2560+RAMPS, D64 not usable?

Hi everybody,

I'm trying to upgrade my printer from V92.3 to V1.0.0dev, but I can't seem to take control of GPIO 64 or 40. I have searched everywhere in the code and I can't find anything assigned to that pin that can clash.

Even setting the pin as output in the "void setup()" function does not make that pin an output. Only when I comment Printer:setup() AND Commands:commandLoop() does that pin honor my request to be an output.

Any ideas?

Thank you,
Errol


Comments

  • Hmm, it is usable, but I can't, for the life of me, get U8G to output CS or A0 of any SPI display, other than U8GLIB_ST7920 to output, on any pin. :(
  • How can pinMode be broken?

    This seems to be the problem. I can't even use M42 to set a pin HIGH, as it also uses pinMode.

    U8G loops through the pins in it's class to set them as output using pinMode.

    The ST7920 has patch code to use SET_OUTPUT as a replacement for pinMode.

    Any ideas?
  • If you check 

    you see there is no digital number for that pin, only a analog one. Have you checked the arduino variants file if it defines that pin a sdigital pin. SET_OUTPUT uses fastio so it is indepependent of the arduino numbering.
  • The issue seems unrelated to the pin. The U8G lib calls pinMode and digitalWrite in a loop setting all the display pins to outputs and high. I have used a logic analyser,  and it never happens, not even for 1us. I have added debug message to the code and it does call pinMode with the correct pin numbers, but nothing happens on the pins.

    Editing Repetier.ino to look like:
    void setup()
    {
          pinMode(40);
          digitalWrite(40, HIGH);
          delay(1000);       
        Printer::setup();
    }
    There is NO high for 1 second, but if I remove Printer::setup() AND Commands::commandLoop() then the pin does set high.

    This looks like Repetier firmware replaces pinMode, or it breaks it.
  • Anyway, maybe I'm looking in the wrong place, but I can't get my display working, as CS and DC does not toggle. :(
  • No, we do not replace pinMode - that is something I'm very sure of. We only have a variant in HAL I think but that is no replacement of global function.

    It also makes not really sense then removing Printer::setup and commandLoop solves the problem as your cod eis run before they do, so how should they interfere. What might be a problem is number of translations. If text segments gets larger then 64kb it is not addressable and with all languages selected this happens. Removing the code might just have reduced text/data to fit critical segment as the pin map is stored in that segment as well.
  • THANK YOU! THANK YOU! THANK YOU! THANK YOU! 

    All the languages are selected in the default configuration file from github, so I just left that as it was. Removing all except EN fixed this very weird issue, and I would never have found it without your help.

    THANK YOU! THANK YOU! THANK YOU! 
Sign In or Register to comment.