Turning FEZ Panda into a ARM devboard

My FEZ Panda was, sadly, sitting there, doing nothing, as the project I’m working on can’t be done with .NETMF Shocked Sad (I didn’t know about that when I purchased it)

Now my Panda is happy again, working as an ARM devboard, thanks to the following:
(edited with the latest tools I’m using, thanks to JDAL for the help)

The basics:
Free Compiler: MDK Version 5
Free Uploader: http://www.flashmagictool.com/
Erase your FEZ Panda: ( ! WARNING ! ) http://www.tinyclr.com/forum/17/2734

In Keil MDK, click Flash → Configure Flash Tools and enter the following:

Enable: Use External Tool for Flash Programming
On Command, set {FLASH_MAGIC_DIRECTORY}\Flash Magic\FM.exe
(be sure to replace the {FLASH_MAGIC_DIRECTORY} with the correct path for the Flash Magic FM.exe file
On Arguments, place this: COM(10,57600) DEVICE(LPC2387,12.000) ERASE(DEVICE, PROTECTISP) HEXFILE(“#H”, NOCHECKSUMS, NOFILL, PROTECTISP)
(replace the COM(10,57600) with the port you are using, if you use COM3, put COM(3,57600) instead)

Now try my Blinky project, which will blink the FEZ Panda LED and also output data via the UART0 port. (the one you are using to flash the LPC chip)
http://www.beat707.com/downloads/LPC2387_MDKlite_Blinky.zip

And I’m impressed on how easy is to setup a USB 2.0 to TTL UART chip (see below) and put the Panda into programming mode: hold LOADR press RESET release everything.
Just connect TX and RX from the TTL UART into the FEZ Panda UART0, which are pins 0 for Input and 1 for Output. So its just like this:

TTL Pin TX → Panda Pin 0 (COM1 In)
TTL Pin RX → Panda Pin 1 (COM1 Out)

Now power up the FEZ Panda board, you can use the USB cable for that, or the TTL 5V output. Hold LDR and press RESET. Now the board is waiting for the Flash Magic program. Once you flash it, click RESET to load the program.

Here’s the UART chip I’m using:
http://www.ebay.com/itm/USB-2-0-CP2102-Module-TTL-UART-6PIN-Serial-Converter-/190532885797?pt=LH_DefaultDomain_0&hash=item2c5ca51d25
(maybe not from this seller, but its the same chip, and I remember paying a bit more: $ 6.5 USD)

Extra files:
LPC23xx Example Files: http://www.standardics.nxp.com/support/documents/microcontrollers/zip/code.bundle.lpc23xx.lpc24xx.uvision.zip
LPC2387 info and files: http://www.keil.com/dd/chip/4531.htm
LPC2387 official NXP product page: NXP® Semiconductors Official Site | NXP Semiconductors

In any event, be sure that your connection to the Panda board is good. To check it out, follow the steps at the following link, under Loading Test Application: http://wiki.tinyclr.com/index.php?title=Porting_Details

The BlinkPandaLED.hex file is missing from that page, but you can use this other one instead: http://www.beat707.com/downloads/Blinky.hex

Thanks again, Wk

Where you went is where i came from :wink:
I do miss the real time, but .net does make doing things much quicker.
I have not decided which way to run yet though.

you may check out [url]http://www.code-red-tech.com/[/url]

They have the compiler and Eclipse all in one.
But i personally use: CrossWorks for ARM - C/C++ Compiler for ARM and Cortex Micros for all my projects.
you might also try their demo, as there are many, many examples to help.

Yup, those are nice but rather expensive tools for me right now. :frowning: Also, those companies are a bit too arrogant IMHO. :-p

I still have no clue on where to start: initiate the chip LPC2387 and all its stuff, how to handle ADC out and UART.

I want to FEZ to PITA! LOL But it will be fun once I figure things out. :wink:

Wk

Get started with the UART so you have a way to debug if you will what the code is doing.

UARTInitialize(115200);

I dont know if the compiler your using implements this or not for printf, but if it does stick this in there.

if it does then its a simple as printf(“Hello World\r\n”);

If not then your going to have to write to UARTWriteChar(char) manually



void UARTWriteChar(unsigned char ch)
{
  // Wait for it to be ready to accept 
  while ((U0LSR & 0x20) == 0);
  U0THR = ch;
}


void 
__putchar(int ch)
{
     UARTWriteChar(ch);
 
}

if not then you have to do it manually.



static unsigned long get_pclk(unsigned long cclk, unsigned long sel)
{
  if (sel == 0)
    return cclk >> 2;
  if (sel == 1)
    return cclk;
  if (sel == 2)
    return cclk >> 1;
  return cclk >> 3;
}


unsigned long get_uart_clk(unsigned long n, unsigned long fosc)
{
  unsigned long pclk = 0;
  unsigned long cclk = liblpc2000_lpc23xx_get_cclk(fosc);
  switch (n)
    {
      case 0:
        pclk = get_pclk(cclk, (PCLKSEL0 & PCLKSEL0_PCLK_UART0_MASK) >> PCLKSEL0_PCLK_UART0_BIT);
        break;
      case 1:
        pclk = get_pclk(cclk, (PCLKSEL0 & PCLKSEL0_PCLK_UART1_MASK) >> PCLKSEL0_PCLK_UART1_BIT);
        break;
      case 2:
        pclk = get_pclk(cclk, (PCLKSEL1 & PCLKSEL1_PCLK_UART2_MASK) >> PCLKSEL1_PCLK_UART2_BIT);
        break;
      case 3:
        pclk = get_pclk(cclk, (PCLKSEL1 & PCLKSEL1_PCLK_UART3_MASK) >> PCLKSEL1_PCLK_UART3_BIT);
        break;
    }
  return pclk;
}


void UARTInitialize(unsigned int baud)
{
  /* Configure UART */
  unsigned int divisor = get_uart_clk(0, OSCILLATOR_CLOCK_FREQUENCY) / (16 * baud);
  U0LCR = 0x83; /* 8 bit, 1 stop bit, no parity, enable DLAB */
  U0DLL = divisor & 0xFF;
  U0DLM = (divisor >> 8) & 0xFF;
  U0LCR &= ~0x80; /* Disable DLAB */
  PINSEL0 = PINSEL0 & (~0xF0)| 0x50;
  U0FCR = 1;
}

Thanks, but none of those work, so my question is, which compiler you would recommend, free if possible. :wink:

Wk

i have a hello world example that i made for you to try to make sure everything is working ok first.

I have renamed the uart.hex to uart.jpg to be able to attach it here. Just rename it to uart.hex and use

Edit…
Renaming it, did not work. If you want to try the hex file how can i send it to you

FlashMagic to upload it. when done close flashmagic and cycle the power and see if you get anything out the uart. Assuming you have a 12mhz rock and terminal is set up 115200,n,8,1

I dont know of any that are free off hand. What i would recommend though is to download the Crossworks trial. make sure everything is working and get some chars out on the UART and blink some leds. Build your confidence up before trying another platform with to many unknowns.

Thanks, good ideas. If you don’t mind, email at williamkwusik [a] hotmail

I will check some other tools, thanks for the advice.

Wk

sent.

Strange, it uploads, but nothing shows on the terminal.

Here’s the thing I got, a FEZ Panda, I erased the board already.

If I hold LDR + RST and release, and enter the terminal and hit ? I see the “Synchronized” message.

But the strange thing is that even at other baudrates I can still see the message, so I guess something is wrong.

Do you mind making that same test at 9600 bauds instead? Please? :wink:

Thanks, Wk

when you hold the LDR button, it forces the processor to boot up into boot loader mode.
which i believe if i remember right it has a auto baudrate when it get the first enter char.
so your still ok.

Let me change it to 9600 for ya.

Txs.

I just installed the Crossworks trial, now I wait for the unlock key from the company. Looks like a very good program, too bad its nearly 2k for the commercial version. :frowning:

Wk

I sent the 9600 example to ya.

The reason why i like them allot is that it has been bullet proof for us for over 7 years now.
but the best reason why i like it is that it come with a tasking library AKA RTOS.
when you get into processors with these kids of speed and not using an RTOS its like what is the point.
you need to be able to do multiple things at once and not get hung up on a blocking call.

I have all kinds of projects for the LPC2378 that you can use to learn with. when you get the demo running, i can send you some of my projects including the one i just sent you.

Oh, that would be great, thank you so much. I have to check if I can make open-source material with the Personal License, as its the only one I can afford.

What you think about code-red-tech.com?

Wk

I tried code red about a year ago. Things probably have changed quite allot since then.

They seem to have a nice package overall. But without the RTOS implementation like CW has i did not want to spend the time and put FreeRTOS in there. even if it would have taken about 20 minutes :slight_smile:

You may try the Xmega for more speed since you are familiar with the tools and compiler.
You can get the Xmega up to 32mhz.

this place has nice compilers at low cost.

they are coming out with a ARM compiler in the very near future.

Personally i would jump to the PIC32 @ 80mhz.

lower cost, smaller package then LPC2378 and faster.

I recommend this for sure http://www.rowley.co.uk/arm/
Very cheap, $150 for personal use but it is a very powerful tool with support to hundreds of ARM devices

Yeah, I’m testing it right now, thanks.

The problem is that even if I release open-source stuff, but the hardware is paid for, they require a commercial version. :-\ Like Beat707.com first product, its Arduino Based, the Hardware is made by Rugged Circuits, but the Software I provided free of charge, open-source.

Wk

yup, i have the Commercial License, though i dont remember what the differences are if any.

the only issue there is going to be that you cannot provide the source that CW generates for you. You can only release the code you wrote.
So for the code that it generates for init the PLL and other things you cannot post.

[quote]the only issue there is going to be that you cannot provide the source that CW generates for you. You can only release the code you wrote.
So for the code that it generates for init the PLL and other things you cannot post.[/quote]

You do not have to use those. Drop in any init code you have, from NXP, for example.

You can even do a “externally built executable” project where you compile on any compiler the use the IDE for debugging. They support many JTAGs but I think theirs, the lite version is the best for you guys. Not cheapest but I know it works professionally at $100 http://www.mouser.com/ProductDetail/Rowley-Associates/CC-ARM-LITE/?qs=sGAEpiMZZMvthb15MeQ6NHhSlXpeL1%252bu