RLPLite getting started

Hi.

I’m trying to start working with RLPLite on Hydra. The first tutorial was fine but then I’m stuck.

The main question is, how do I access (GPIO read/write) pins on Hydra? Is there some more advanced tutorials/examples than the basic demo?

Thanks!

Access them directly through registers. You need the processor datasheet and the examples provided by atmel.

I see. Well, now me search will be much easier :slight_smile:
Thanks!

OK, got it with the registers but now I have a new problem -

In RLP I have while(1) loop. It works fine, but now I cannot deploy new code. VS2010 writes “Preparing to deploy assemblies to the device” and nothing happens.
Anyone have an idea, how to work it around?

@ Stargazer - others might have better advice, but for me I just reset the device while deploying or just as the deploy starts. It might take a few attempts, but normally it will catch the device before at the right time and manage to deploy.

Depends upon what is within the while loop. If the processor gets into a tight loop, then it is difficult for Visual Studio and the debugger to attach to your device.

What are you trying to achieve in the loop?

Well, it was just the first attempt to work with registers, so I’m turning on and off a few pins.


while(1)
{  
	AT91C_BASE_PIOD->PIO_CODR = 1;
	AT91C_BASE_PIOD->PIO_SODR = 1;
}

As I had no other ideas, issue was solved by FW update, though it was a bit tricky, as FW updater couldn’t connect to the device either. I know it’s overkill, but I couldn’t come with better solution.

This is a very tight loop. You need to put Thread.Sleep() in it.

The referenced code is in C using RLPLite. There is no threading available with the lite version.

With RLPLite you have to call the routine from managed code and then return. The sleep would be in the managed code.

But, if you are playing with the registers, why not use the register class?

Tight loop and debugger not attaching - simplest way to deal with that is to hit reset and hope you have enough spare cycles in your app startup that allows the debugger to attach before it hits your tight loop again. Harder way is to go into bootloader and erase all. Best solution, like Mike says, don’t do a tight loop and return back up to managed code and rest :slight_smile:

Doh!

If I’m testing tight RLP code, then I write this managed code in the very beginning:


bool wait = true;
while (wait) Thread.Sleep(500);

This way I need to manually set wait to false using watch or immediate window before the program starts. But if you press reset, the board will stick in that loop and you can deploy easily .

1 Like

Register class?

I’m working on an RLP solution with Hydra. AFAIK, there’s not libraries I can include, which will make my life easier. If there is, PLEASE let me know.

Now one more thing - I couldn’t find any simple code examples for RLPLite, which would explain simple things like setting ON and OFF a pin, reading data from a pin and so on. I’m trying to work with AT91SAM9RL64 chip, which is used on Hydra and it’s a bit complicated. The only thing I could find is AT91SAM9RL64.h which maps the CPU API, while it’s complicated too.

@ Stargazer - You need to go back to the chosen answer for this thread and download the user manual for the Hydra’s uC. It will give you all the info you need.

This is what I’m doing. I’m just saying, that it isn’t explained well anywhere.