Severson-Group / AMDC-Firmware

Embedded system code (C and Verilog) which runs the AMDC Hardware
http://docs.amdc.dev/firmware
BSD 3-Clause "New" or "Revised" License
30 stars 5 forks source link

Make/Find Basic Zynq-7000 Interrupt Project #363

Closed codecubepi closed 3 months ago

codecubepi commented 4 months ago

Learn how to use the software generated interrupts in the Generic Interrupt Controller (GIC) on the Zynq-7000, so that I can proceed on #347

I will attempt to find/make/modify a very basic project that simply sends an interrupt from one core to another and turns on an LED or similar function.

Resources (in order of most useful to least useful):

codecubepi commented 4 months ago

As of now (01 Mar 24, 22h45), I have modified this example to be dual-core compatible and have got core-to-core interrupts going from CPU1 to CPU0 (but only that direction).

Attached is a zip of the dual-core projects, since I don't want to commit this test project to any branch, but still want to have a checkpoint of a semi-working state.

interrupt_projects.zip

codecubepi commented 3 months ago

As of now (18 Mar 24, 21h45), I have modified this example to be dual-core compatible and have got core-to-core interrupts going in both directions.

The culprit seemed to be that CPU1's interface to the GIC was not being intialized, since the CPUInitialize() call in XScuGic_CfgInitialize() is gated off. So I copied the two register writes in CPUInitialize() into CPU1's main() function. That seemed to magically do the trick.

Attached is a zip of the dual-core projects, since I don't want to commit this test project to any branch, but still want save a copy of the working state.

interrupt_proj_working.zip

Console Output

CPU 0 CPU 1
Attempt to interrupt the other core I i
Interrupt written to SGI register successfully J j
Processed interrupt in ISR Z z

Image

npetersen2 commented 3 months ago

Nice work!