Content originally posted in LPCWare by rogerwilson on Wed Jun 12 14:36:19 MST 2013
[FONT=Arial][SIZE=2]R2D2,[/SIZE][/FONT]
[FONT=Arial][SIZE=2][/SIZE][/FONT]
[FONT=Arial][SIZE=2]Thanks for sending me your version. After a lot of head scratching I finally noticed you'd moved the line:[/SIZE][/FONT]
[FONT=Arial][SIZE=2][/SIZE][/FONT]
[FONT=Arial][SIZE=2][COLOR=#0000c0][COLOR=#0000c0]LPC_RIT->RICTRL[/COLOR][/COLOR] |= (0x1<<0);[COLOR=#3f7f5f][COLOR=#3f7f5f]/* clear interrupt flag */[/COLOR][/COLOR][/SIZE][/FONT]
[FONT=Arial][SIZE=2][COLOR=#3f7f5f][/COLOR][/SIZE][/FONT]
[FONT=Arial][SIZE=2][COLOR=black]from the bottom of RIT_IRQHandler to the top i.e. last instruction to first instruction. For a reason I can't understand, this makes all the difference. With this line as the last instruction, the wrong frequency is generated with -Os. With it as the first instruction, it works.[/COLOR][/SIZE][/FONT]
[FONT=Arial][SIZE=2][/SIZE][/FONT]
[FONT=Arial][SIZE=2]If you have any ideas at all about why this might be the case, I'd love to hear them as this is totally weird!![/SIZE][/FONT]
[FONT=Arial][SIZE=2][/SIZE][/FONT]
[FONT=Arial][SIZE=2]Rog.[/SIZE][/FONT]