Switches and LEDs on the ADSP-CM408F EZ-KIT Lite Board

by Crossware 15. August 2014 16:11

We are developing support for Analog Device's ADSP-CM40x microcontrollers.

We received our ADSP-CM408F EZ-KIT Lite board on Monday and set about investigating the operation of the JTAG/SWD debugger interface.  Pretty soon we could download and run programs in SRAM.  (Lots of omissions and errors in ADI's reference manual though so it took a lot longer to get there than it should have!)

As usual during such developments we incrementally work our way though the peripherals adding register definitions, simple context menu wizards, simulation and so on, testing that things work along the way.

There are lots of examples for this board provided by ADI but we couldn't find anything remotely simple.  So here is how to read the input switches SW4 and SW5 and illiminate the LEDs LED1 and LED 2:

// Initial CPP Source File
#include "xstdsys.h"

main()
{
    // use the Wizards (see Wizards menu) to configure the on-chip peripherals
    g_pPORTF->INEN_SET = 1 << 10;
    g_pPORTE->INEN_SET = 1 << 8;
    g_pPORTE->DIR_SET = 1 << 7;
    g_pPORTE->DIR_SET = 1 << 6;

    while (1)                   
    {
        if (g_pPORTE->DATA & (1 << 8))
            g_pPORTE->DATA_SET = 1 << 7;
        else
            g_pPORTE->DATA_CLR = 1 << 7;
        if (g_pPORTF->DATA & (1 << 10))
            g_pPORTE->DATA_SET = 1 << 6;
        else
            g_pPORTE->DATA_CLR = 1 << 6;
    }
}

Pressing SW4 illuminates LED2 and pressing SW5 illuminates LED1.  That's all there is to it if the board boots in the factory configuration (SPI master boot mode with POST installed).

However, the installed POST program has already configured the Soft Configuration switches.  To use the switches and LEDs from 'No Boot - idle' mode, the Soft Configuration switches must be configured.

Tags: , ,

Blog

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About this blog

This is where you will find topical information that we think might be useful to you.

Month List