Post Go back to editing

Simple program to test ADSP-21488

Hello, could any one show example how to test my setup ?
( i made flash programmer, and development board,25MHz CLK, Boot config SPI_MASTER (01), and CLK konfig is 00)
In loader setup, should i sue SPI_FLASH, or SPI_MASTER ?

my program looks like this:

#include <def21488.h>

#include <cdef21488.h>

#include <math.h>

#include <SRU.h>

#include <asm_sprt.h>

asm("#include <def21489.h>");

#define NOP asm volatile("nop;")

void initPLL(void);

void Mandelbrot(float zoom);

int main( void )

{

    initPLL();

    asm("bit clr FLAGS FLG1;"); //CS LOW

    asm("bit set FLAGS FLG1;");//CS HIGH”

   

     while(1)

     {

        asm("bit clr FLAGS FLG1;"); //CS LOW

        asm("bit set FLAGS FLG1;");//CS HIGH”

      }

   

}

void initPLL(){

int i, pmctlsetting;

    // Set INDIV bit in PMCTL register

    pmctlsetting = *pPMCTL;

    pmctlsetting |= INDIV;

    *pPMCTL= pmctlsetting;

    // Program PLL multiplier to same value as CLK_CFGx pins/previously programmed value in software……

    *pPMCTL = pmctlsetting;

    // then place PLL in bypass mode

    pmctlsetting |= PLLBP;

    *pPMCTL = pmctlsetting;

    //Wait for recommended number of cycles

    for (i=0; i<4096; i++)

          NOP;

    // Bring PLL out of bypass mode by clearing PLLBP bit

    *pPMCTL ^= PLLBP;

    for (i=0; i<16; i++)

          NOP;

    pmctlsetting = *pPMCTL;

    // Clear the previous PLL multiplier

    pmctlsetting &= ~PLLM63;

    // Clear the INDIV bit

    pmctlsetting &= ~INDIV;

    // or set the INDIV bit

    // *pMCTL |= INDIV;

    *pPMCTL= pmctlsetting;

   

    // CLKIN= 25 MHz, Multiplier= 16, Divisor= 2, CCLK_SDCLK_RATIO 2.5.

    // Fcclk = (CLKIN * 2 * M) / (N * D)

    // VCO frequency = 2*fINPUT*PLLM = 2*25*16 = 800 <= fVCOmax (800 MHz)

    // M = 1 to 64, N = 2,4,8,16 and D = 1 if INDIV = 0, D = 2 if INDIV = 1

  

    pmctlsetting=SDCKR2_5|PLLM16|DIVEN|PLLD2;

    *pPMCTL= pmctlsetting;

    pmctlsetting|= PLLBP;    //Setting the Bypass bit

    pmctlsetting^= DIVEN;    //Clearing the DIVEN bit

    *pPMCTL= pmctlsetting;    // Putting the PLL into bypass mode

    //Wait for around 4096 cycles for the pll to lock.

    for (i=0; i<5000; i++)

          NOP;

       pmctlsetting = *pPMCTL;

    pmctlsetting ^= PLLBP;          //Clear Bypass Mode

    *pPMCTL = pmctlsetting;

     for (i=0; i<16; i++)

          NOP;

  

}
Problem, i don't get any FLAG1 toggle, and i really don't know why,  (Photo of home made board for ADSP-21488, later it will be used in my master degree work, in university)

  • Hi Linus,

    You can use the SPI Flash to create the loader file .

    The flag pin should be first made as output by setting the corresponding FLGxO bit in the FLAGS register .

    Eg : bit set FLAGS FLG4O;

    Do you have a JTAG interface on your custom board? First you can connect to the target through an emulator and run the code to make sure that the custom board is working .

    Regards,

    Mahesh

  • Thanks for the answer. I use TPS2024 200MHz oscilloscope to test flags, so i should see any toggle at flag pin, but i see only high state (because of weak internal pullup i guess)

    void Delay(int a)

    {

        while(a)

        {

            a--;

        }

    }

    int main( void )

    {

        initPLL();

        asm("bit set FLAGS FLG1O;");

         while(1)

         {

            asm("bit clr FLAGS FLG1;"); //CS LOW

            Delay(0xFF);

            asm("bit set FLAGS FLG1;");//CS HIGH”

            Delay(0xFF);

          }

    }

    I loaded this code to spi flash. i get activity on cs,clk,mosi, miso pins, but i don't see any toggle on output.

    I have right power-up sequence (VDD_INT, 1ms, VDD_EXT, 500us,RESET). CMOS oscillator is also ok.

    Any idea what could  problem be ?

    My spi_flash programmer first delete flash, so i get 0xFF, after that, i program required number of pages with data from ldr file, starting with zero address (MSB bit first, as in flash specification). and if i left with page half full with data, i just write zeros. Did i forger something ?

    (it is a bit frustrating to start work with ADSP-21488, by making my own boot spi flash programmer, and my own board)
    Here is powerup:
    YELLOW is VDD_INT, BLUE VDD_EXT, RED CLK (it is 25MHz, just strobing),GREEN RESET

  • Hi Linus,

    Sorry for the delay in answering .

    Did the code run properly through an Emulator . If the code failed to run through an emulator , we cannot say this as a booting problem .

    If you are able to load and execute the application using a JTAG ICE, but is unable to execute the applications when boot-loaded, consider the following points while debugging:

    • Check the BOOTCFG pins of processor and ensure that they are properly connected to digital voltage level high or level low. When resistors are used to provide flexibility to change boot mode, ensure that the right ones are populated.
    • Ensure that the /TRST signal of the JTAG ICE is connected to board ground. Do not leave this signal floating. Letting this signal float may cause boot failures or other memory access failures.
    • Ensure that the correct boot kernel is used before generating the loader (.LDR) file. If you are using a modified boot kernel, try using the default boot kernel supplied with Visual DSP++Registered together with an example application (like flag toggle) to confirm basic boot-loading.
    • Ensure that you have selected the correct parameters while generating the .LDR file. Selecting an inappropriate parameter may cause the boot to fail.
    • Check whether the code boot-loaded using an ICE (in-circuit emulator). Connect the ICE to the target and open a simulator session in Visual DSP++. Turn on the target to start boot-loading. Change the session from “simulator” to “emulator” and look at the Disassembly window. This shows whether the application boot-loaded from the external source. If you do not see the expected code, there is a boot failure. You can also use this method to check whether the processor downloaded the initial 256 instructions.
    • Ensure correct power on reset timings as specified in the data sheet.
    • Check the CLKCFG signals and ensure that the PLL is not overdriven. Ensure that the ratio selected in combination with the CLKIN frequency does not exceed the core clock to a value greater than specified.
    • Check for the integrity of tracks on the board as there may be open circuits or short circuits on the board. You can also monitor RSTOUT to confirm the PLL lock

    Also refer to the Application  note given in the following link:

    1. EE-223 :In-Circuit Flash Programming on SHARCRegistered Processors

    http://www.analog.com/static/imported-files/application_notes/EE.223.In.Circuit.Flash.Programming.on.SHARC.Processors.Rev.2.02.07.pdf

    1. EE-305 :Designing and Debugging Systems with SHARCRegistered Processors

    http://www.analog.com/static/imported-files/application_notes/EE-305.pdf

    Regards,

    Mahesh

  • i forgot to mark this as answered.
    Since i made pcb for adsp-21488 and flash programmer by using stm32f415 and Labview, i had many problems to troubleshot, but now it in working order (simple flash programmer, no fancy debugging because it will be to hard to make)

    That is why i write here so i can be sure that program in flash is good, and i have to look elsvere for problems