0

I am trying use an OLED display with an atmega328p. The OLED uses an 8 pin data interface. Therefore I need to switch several pins between input and output and vice versa. If I switch one pin everything is fine but if I switch 2 or more than the controller seems to trap. I just have an STK500 clone and cannot debug the code on the controller. I toggle a LED on a separate pin to see that the controller is still running. In the user manual there is a section where it is mentioned that one must ensure that the input and the output state must fit to ensure that the pin is not in an undefined state. But it is not mentioned that this will result in a trap. Nevertheless I ensured that the pins are in the correct state before I switch them. Even if I switch a pin from output to input and back several times the controller traps. I do not use the arduino environment. The compiler I use is the avr-gcc on linux. For programming the avrdude is in use.

I've tried it with the pins connected to the OLED and not connected. It does not make a difference. I also tried it with a little delay of 1ms between the switching. That also does not make a difference

Thanks for your help.

  • 1
    Please [edit] your question and show the code as a [mre]. How do you know that *the controller traps*? – Bodo Jul 27 '23 at 12:53
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jul 27 '23 at 17:18
  • If I call the function where the toggeling happens then the LED stops blinking. That is why i assume that the controller trapps. I will provide code on monday till then I am not at home and can't access it. – purpleCheesus Jul 28 '23 at 09:34

0 Answers0