Skip to content

SPI slave ISR not raised #296

Closed
Closed
@aznoohwee

Description

@aznoohwee

I found that IRQ is not raised when simulating firmware operating as a SPI slave.

PR is WIP to see if there is anything else that needs to be done but here is a quick fix.

static avr_cycle_count_t avr_spi_raise(struct avr_t * avr, avr_cycle_count_t when, void * param)
{
avr_spi_t * p = (avr_spi_t *)param;

if (avr_regbit_get(avr, p->spe)) {
	// in master mode, any byte is sent as it comes..
	if (avr_regbit_get(avr, p->mstr)) {
		avr_raise_interrupt(avr, &p->spi);
		avr_raise_irq(p->io.irq + SPI_IRQ_OUTPUT, avr->data[p->r_spdr]);
	}
    // in slave mode, bytes are sent but no interrupt is raised
    // TODO check for state of SS line??
    else {
		avr_raise_irq(p->io.irq + SPI_IRQ_OUTPUT, avr->data[p->r_spdr]);
    }
}
return 0;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions