The link to the code is broken
Probably it would be safer to clear all interrupts flags before enabling any of them. When you enable the internal pull-up, this could trigger an interrupt.
i would suggest
enable the internal pull-up
clear interrupt flags
enable interrupts.
Did you also tried with real pull-up resistors?
Bookmarks