Lately I have been writing a linux loadable kernel module which is a character driver for the BCM/I2S interface of the BCM2835. I need this to access a specific i2s codec.

Although generally everything has gone smoothly, I am facing big problems with serving interrupts related with this interface. You can see here (page 119 onwards) that interrupts can be enabled when data are received, which is what I want to achieve.

The problem is that once one such interrupt is triggered, the whole Raspberry Pi becomes unresponsive and I have to power reset it to recover from this situation!

In my dev_open function I call the request_irq function to register the i2s_interrupt_handler for the interrupt number 79:

result = request_irq(I2S_INTERRUPT, (irq_handler_t) i2s_interrupt_handler, 0, DEVICE_NAME, NULL);
    if(result < 0) {
       printk(KERN_ALERT "Failed to acquire I2S interrupt %d. Returned %d", I2S_INTERRUPT, result);
       return -EBUSY;

The interrupt handler function is currently this: (just wanted to do proof of concept):

static irqreturn_t i2s_interrupt_handler(int irq, void *dev_id, struct pt_regs *regs) {    
    printk(KERN_NOTICE "i2sMIDrv::i2s_irq_handler: Came here!");

    return IRQ_HANDLED;

Then, when I need to receive data I enable the TXW interrupt using the INTEN_A register and as soon as I do receive data, the Pi hangs!

Any ideas why this is happening? How could I try to debug it?

Also note that if I don't call the request_irq function but still enable TXW interrupt, nothing bad happens and I can see that upon reception of data, the interrupt status flag in the INTSTC_A register is set.

I am totally newbie in kernel programming, so please don't assume anything!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.