Doeddwn/d’on i ddim forms are when it has been an ongoing action (doeddwn/do’n i ddim yn meddwl - I didn’t think - lit. I wasn’t thinking, doeddwn/do’n i ddim yn gwbod - I didn’t know - lit. I wasn’t knowing, etc). The auxiliary form which uses gwneud (nes i ddim darllen y llyfr - I didn’t read the book, nes i ddim gweld y rhaglen - I didn’t see the programme) is when the action has not been ongoing.
This will help too - How to do the past tense: New version of my old video