Friday, 15 January 2010

Interrupted train of thought

So i've been trying to get interrupts working on my beagleboard since yesterday ... bloody hell what a hassle. First I was trying to get a 1Khz clock going but not having any luck I switched to getting the vblank interrupt going. Of course, writing to the registers properly rather than using the offset as an index to an int * went a long way to making progress there. Damnit I keep doing that, envisioning each array access as register indirect with offset, when it isn't quite that. Yesterday I didn't make much progress - the busy workers, the noise, and the ungodly early start to the morning kept me from being able to concentrate on anything too much.

But even after working in it most of today ... it still isn't there. I (finally) get the interrupt ok, but then it never turns off and instantly returns once it's finished. Well either that or causing random crashes in the non-interrupt code. So some problems with the interrupt handler somewhere itself - like clobbering registers - as well as the way it's talking to the hardware (I'm clearing the interrupt everywhere i've discovered it needs clearing - the DISPC and the INTC). Might leave it for the weekend and see if a fresh mind doesn't help.

Oh, I also ran across some curious behaviour with the assembler and/or linker. I had some code intermixed with some constant strings. The code following the strings was all messed up, it was being written to non-aligned addresses (which is wrong for ARM). And even when I fixed that up with a .balign pseudo-op, the memory references within the code were wrong. e.g. a function call jumped to the wrong address - out by 2 bytes. Moving the strings after all the code segments fixed everything up. *shrug*

The A/C got installed ok yesterday - well eventually. The ceilings turned a 3 hour job into a 7.5 hour one. Although I think some of that was just throwing the installation guys off balance a bit. Well, it's all done now. Nice too - managed to sweep away all the stale smelly air in a matter of minutes, which was a nice bonus ontop of the cooling. Now I just need a good stretch of hot weather to test it properly. February is always guaranteed to oblige with that, and is just around the corner. Also cleaned up some of the wood in the yard from the photo in the last post. Not that you'd tell if I took another picture now.

Just went out for a few drinks and was hankering for a pizza on the way home. Nearly dropped by the local joint but needed a wee more than some baked fat. So being the tight-arse hermit I am, I thought i'd make one up rather than venture back into the wilds of the night. I also wanted to try and use some chapati as the base. I've been too lazy to make yeasted bread lately, so chapati has been a bit of a staple when I felt the need for some bread. Had some frozen sauce left over from earlier efforts, chucked on some bacon, cheese, onion, capsicum, chillies and even some thinly sliced squash (i'm drowning in the damn things), bung it in a hot oven, and bob's a dead cousin.

So for something a bit different, here's the chapati recipe I use, although there's not much to it:

  • 1.5 cups plain flour
  • 1 cup wholemeal flour (adds a nice texture)
  • 1 cup water (warm)
  • 0.5 - 1 tbsp olive oil - vital, stops it sticking to everything like glue

Mix together till it forms a dough. Knead for 10 minutes. Rest for 10 minutes wrapped in glad wrap. Break off a 3-4cm ball and roll out flat with a rolling pin to about 2mm thick. Cook on a dry medium-to-hot frying pan or hot plate for 1-2 minutes per side - until it dries out on top and goes dark on the bottom and puffs up a bit. Dough can be kept in the fridge for a day or so until needed, so it's 'single friendly' - it gets a bit tougher which makes a stronger bread too. This will make 6, and they are very filling (each one is approximately equivalent to 2-3 slices of typical wholemeal bread).

The cooking and how thin you roll it is tricky to get right. I've had everything from crunchy `salada' biscuits (which gave me an idea, might try making crackers one day) to something very like naan bread (much preferable with a typical meal). If you cook with some oil it turns it into a sort of fried pastry/tough pancake - tastes great but just has to be bad for you. I've also tried using a pasta maker to roll the dough, if you don't mind it not being round. The layering you get if you keep doubling and running it through the machine also alters the result (don't go too thin of course). It's supposedly possible to have it puff up like a balloon if you finish over a hot flame, but I've never managed it.

For the pizza I undercooked it a bit since it was going in the oven as well, but cooking it a bit first made it a lot easier to handle and put on the pizza stone (something I never managed with bread dough without using baking paper).

6 comments:

Sankar said...

While preparing chapati, it is suggested that if you add ghee (while heating) the chapathi will come softer and tastier.

http://en.wikipedia.org/wiki/Ghee

Maybe give it a try once if possible.

Biscuit said...

To re-enable interrupts at end of handler:

ldi32 r1,MPUINTC_BASE
mov r0,#1<<0
str r0,[r1,#INTCPS_CONTROL]

But in your interrupt handler, the C++ side, you must:

Status = GPTIMER[1]->TISR;
GPTIMER[1]->TISR = Status;

NotZed said...

"To re-enable interrupts at end of handler ..."

Yeah, I am writing to INTCPS_CONTROL. And I gave up on the GPTIMER1 stuff (I couldn't get it to actually interrupt) and was trying VBLANK instead. So I am writing to DISPC_IRQSTATUS in the same manner. I'll have another go when I feel like it :)

Sankar: Might have to try it if I ever get any ghee. Cooking with oil probably has a similar effect, if perhaps not so tasty :)

Sankar said...

May be try with butter / cheese . I believe it will work out ~same.

Biscuit said...

It's the lower part that resets the interrupt on the timer, BTW.

Are you trying some bare metal stuff? Sounds like it. If so, have you had much luck configuring display for TV out? None of the TI register settings seem to work.

NotZed said...

biscuit: yeah trying bare metal. The lack of progress is getting a bit frustrating so i'm not spending much time with it.

I use a DVI monitor, and I have just enough for that to work (from the old boot splashscreen patch). And with that code, with TV out I get a weird scrolling colour-bar thing (the test-pattern generator perhaps?) that wont even sync.