Panda II register access

I am trying to code an ISR using a register class, but getting an exception,

[quote]#### Exception System.ArgumentException - 0xfd000000 (1) ####
#### Message:
#### GHIElectronics.NETMF.Hardware.LowLevel.Register::.ctor [IP: 0000] ####
#### FEZ_Panda_II_Reg_SPI.RegSPI::.ctor [IP: 005d] ####
#### FEZ_Panda_II_Reg_SPI.Program::Main [IP: 0004] ####
A first chance exception of type ‘System.ArgumentException’ occurred in GHIElectronics.NETMF.Hardware.dll
An unhandled exception of type ‘System.ArgumentException’ occurred in GHIElectronics.NETMF.Hardware.dll[/quote]

This is only happening when creating registers in the address range

 public const uint VIC_BASE_ADDR = 0xFFFFF000;
    public const uint VICIntSelect = VIC_BASE_ADDR + 0x00C;
    public const uint VICIntEnable = VIC_BASE_ADDR + 0x010;
    public const uint VICIntEnClr = VIC_BASE_ADDR + 0x014;    
    public const uint VICVectAddr = VIC_BASE_ADDR + 0xF00;

public const uint VICVectAddr = VIC_BASE_ADDR + 0xF00;

This fails

Register VICVectAddr = new Register(SPI_Regs.VICVectAddr);

Is there a range of registers that cant be accessed this way on the Panda II?

Those are protected as you are not suppose to use the interrupts directly, which will crash the system. But, they are not protected in 4.2 so you can access them if you really know what you are doing.

@ Gus - Is there a method for writing an ISR on the Panda or am I stuck with RLP?

ISR for what?

@ Mike - I wanted to add an ISR to my SPI reg class, but it looks like the only way is to do it is via RLP.

Managed code can’t handle CPU interrupts. Your only option is RLP. From there, you could use the PostManagedEvent function from RLP to do work in managed code, but know that the RLP->managed transition is NOT realtime (and not fast enough to handle high-frequency events).

That is the answer. :slight_smile:

Thanks guys! I dont have a problem doing it in RLP, I just thought it would be nice to do it on the managed side.

@ Mike - Gus gave the answer. I was hoping that one of you guys had something i could use.

Please take a look at RLP extensions. Yes you can install an ISR in premium RLP.