If you are using RetroPie 3 beta 4, and the config via Emulation Station isnt working for you, try removing the files here
“cd /opt/retropie/configs/all/retroarch-joypads”
Then you can see whats there with “ls”
You can delete them all
“rm *.cfg”
Then recreate by running the retropie-setup script and choosing the register retroarch joypad option.