This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MCBSTR9 - another noob... (beginner problems with GPIO)

Dear Colleagues,

A bought an MCBSTR9 DSK + Ulink2 programmer. I never had so much trouble with lack of a good quickstart documentation than with this setup.

My problem:
I wrote simple program that should just switch on every 2nd pin on GPIO7 and run in an endless loop (just in case), but it actually doesn't do anything (even the port direction, data, etc registers don't respond - the debugger shows they're all reset all the time).
For what I can see, it does compile and load correctly

In the configuration file (STR91x.s) I left all by default, except that I switched on the Port Clock Gating for GPIO7

Can someone please tell me what am I missing here?

Here's my simple program:

#include <91x_lib.h>

int main (void)
{

GPIO_InitTypeDef GPIO_InitStruct;

GPIO_DeInit(GPIO7);

GPIO_InitStruct.GPIO_Direction = GPIO_PinOutput;

GPIO_InitStruct.GPIO_Pin = GPIO_Pin_All;

GPIO_InitStruct.GPIO_Type = GPIO_Type_PushPull ;

GPIO_Init (GPIO7, &GPIO_InitStruct);

GPIO_Write(GPIO7, 0xAA);

while(1);
}

Best Regards,
Istvan

  • Maybe this: (in STR91x.s)

    
     <h> Peripheral Reset Register 1 Configuration (SCU_PRR1)
    
    
     <o2.21>       RST_GPIO7: GPIO7 Port reset
    ;//       <0=> In reset <1=> Not in reset
    
    
    SCU_PRR1_Val    EQU     0x00C40800
    
    

    Looks to me that pin21 is 0

    0000 0000 11 *0* 0 0100 0000 1000 0000 0000

  • Just tried it. I set it to "Not in reset" but nothing changed. I can try to paste the config file here if it would help

  • Hmm...actually when I run the program step by step, nothng seems to be happening. When I read back the system registers (PLL, etc) it's all incorrect (not like I have set them up). The debugger is set to use Ulink (not simulator).
    Then again, when I load some of the example applicatons, they work fine. I try to compare my setup and the example, but can't find any signifficant difference.

  • The program isn't running at all. (PC is on 0 all the time), or the device is in reset all the time.
    I must me missing some major clocking issue which actually messes up the debugger too (I'm often geting the Can't stop the device error when I start up the debugger) - and not it's not a driver problem, the example programs work well!

    I wonder how did you guys start with this board. When I manage to make this board run, I'll write a beginner's manual, for the quick start guide says, just create a new project, set up the device and go. I wish.

    Nevertheless, I think I'm seting up the project correctly - nothing much to miss there. I'll look up around the configuration wizard.

  • I've managed to trace the program.
    It actually stops at the very start of the initialisation file (STR91x.s).

    The reset starts with:

    Vectors         LDR     PC, Reset_Addr
                    LDR     PC, Undef_Addr
    

    Instead of jumping to the proper reset/boot routine it continues to the 2nd line (Undef_Addr) and runs there in an endless loop.

    I looked up the Reset_Addr in the source, it's as follows:

    Reset_Addr      DCD     Reset_Handler
    

    and then Reset_Handler:

                    EXPORT  Reset_Handler
    
    Reset_Handler
    
                    NOP     ; Wait for OSC stabilization
                    NOP
                    NOP
                    NOP
                    NOP
                    NOP
                    NOP
                    NOP
    

    ....etc and then the initialisation starts, but it never gets here. It just runs in an endless loot on the 2nd instruction.

    This is all located in the same (init) file.

    I'm looking it up now, but do you have any hints about this?

    Best regards,
    Istvan

  • Right. I got used to answer my own questions.
    I missed to include the 91x_it.c interrupt handler file. The program seems to be running now but nothing seems to be happening. I tried to measure the voltages on the board - nothing, and also when I open Peripherals -> GPIO7 it's naturally also all reset.
    Infacet, when I open the Power System and Clock Control window, it also shows no changes, regardless that I have made changes to the Configuration Wizard (tried to turn the PLL on/off etc, but it doesn't reglect to the device)...

    Any help about this? What I can say is, that I to connect to the board and I'm not in simulation mode - I'm definitely debugging live.