• Thank you! I had connected a 4*20 serial LCD display to A0 (UART4TX) which also is labeled BTN1. After moving the wire to C6 (USART6TX) and changing Serial4 to Serial6 it works fine. I can now unplug the STM2F4 Discovery board and when I power it up from an external source or a computer it works as expected.
    During my troubleshooting I first tried the suggestion to type load(); after powering up and found that the simple Rotaryencoder program would start working after I pressed Enter, so apparently the programs are saved after typing save(), but they would not load at power up if I had my display connected to A0 pin. I am using a simple level translator for the display communication, as it has a 5V controller. the level translator consists of an npn transistor with base connected to 3V through an 18k resistor, emitter to the Discovery TX pin and collector to the display RX pin, with anohter 18k pullup resistor to 5V of the Discovery. this will give 5V swing on the display signal while the Discovery pin only swings 3V. Just in case someone is interested in a simple level shifter. Another simple circuit that works is to use a small diode 1N4148 from RX to TX, still need the pullup to 5V on the display. This gives about 0.6V to 3.6V on the display RX pin which in most cases works, even if the worst case may require 4V for a high level.

About

Avatar for tage @tage started