When I started making curries, I used to go about it this way: Heat oil in pan, add g&g wait for sizzling to stop and tas soon as I'd throw in the ground spices into the pan and start mixing them with the spoon, they'd immediately turn into a "thick paste" so to say and there'd be no oil left to keep the spices "moist".
This would be generally when the spices would burn if I happened to mix them for far too long.
I have since given up on that and not only do I add the tom before the spices I also raise the pan from fire to add them.