Main Site Documentation

Getting Started with RLP


I’ve been playing around with the RLP stuff on my Panda with the latest beta SDK. Got the examples running, but I have a few questions. I tried searching the forums for answers, but didn’t have much luck.

In managed code, you can directly access registers using the Register class. Is it also possible to access this address space from native code? Say for example I want to toggle a GPIO bit. Should I be able to do this from the native code? I’ve made a few attempts, but not having any luck.

Secondly, assuming you are able to do what I asked in the first question, how do the native/managed code interact? For example, if in my managed code I create:

OutputPort op = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.IO13, false);

And then in my native code that executes at some point later, I change the direction of that I/O port (say I define it as an input), what happens to the managed object? Or, does this even make sense?

It seems to me that you could really mess things up if you don’t know what you are doing. If you aren’t careful when you muck around with low level registers in native code that may have already been referenced in managed code, you could create havoc. Is this a true statement?

Just trying to learn…


I think you statement is strongly valid.
The one who is using the RLP should know what he/she doing and should use it only when it is needed. For example, to write code for an algorithm that requires a lot of processing. another example is to handle some signals in real time that managed code can not handle.


But as far as addressing is concerned, I can write my native code using the same register addresses that are documented in the NXP documents, correct?


I suppose yes you can. but you have to be aware the concequences of messing up registers used by the NETMF firmware.


Yes, if you change anything in native code, the managed code has no idea what happened. For example, you shouldn’t change the direction of the port unless you are sure what is going on…
Toggling a pin in RLP can be done using something like RLPext->SetPinState…

In native code, you use what is provided by NXP.
To use a register for example:
#define MY_REGISTER ((volatile unsigned *)0x12345678)


So when using the various members in the RLPext structure for GPIO, how does the pin identification work compared to ChipworkX?

For example, in RLP.h there is:

#define RLP_GPIO_CWX_PORTB(x) (x+32)	// ChipworkX

What is needed for USBizi?



You have to pass the USBizi IO number (28,6,7…).
Note that these do not necessarily correspond to the FEZ Pins.
The get internal pins number, add the FEZ Panda assembly for example and then in visual studio right click on the FEZ_PIN and click go to definition.
You will get the internal number:
public enum Digital
LDR = 0,
UEXT6 = 1,
Di5 = 2,

so for Di5, you pass 2 to the RLPext.