Weird output on 16X2 JHD162A LCD display
Your problem is that the display keeps its state during MCU reset. When cold-booting, the initial data mode is 8-bit which you immediately switch to 4-bit which reads data with a pair of EN pulses.

When you reset the MCU, you do not know whether even or odd number of EN pulses were sent. So you have to somhow reset the display even if it does not have reset pin.

This can be done by sending 0x33 0x33 (in 8-bit mode it will mean 4-times switch to 8-bit, in 4-bit mode it will mean once or twice switch to 8-bit). Then you can be sure that you always start from the same state.

Then proceed with regular 0x32 (or 4-bit 0x02 if you have single 4-bit write function), 0x28 to get into 4-bit 2-line mode.