Actually you need a pat on your back! You solved a problem by yourself that we couldn't visualize just by reading your code - it's the best way to learn and don't be embarrassed. When dealing with peripherals sometimes it is a good thing to make sure one has a reasonable configurations - chips usually fail through hardware issues - but software often gets carries the blame....

-warrier