Skip to main content
Visitor II
July 13, 2007
Question

STR91x Standard firmware LibraryV1.2 (CAN Example) with keil

  • July 13, 2007
  • 4 replies
  • 970 views
Posted on July 13, 2007 at 06:46

STR91x Standard firmware LibraryV1.2 (CAN Example) with keil

    This topic has been closed for replies.

    4 replies

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:44

    Does anybody try to run any example included in STR91x Standard firmware Library? I try to port with keil the Can example, but I need to modify the I/O led function for switch on the led! The other Can function function correctly?

    Thanks runblade

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:44

    I ported the code for str9x dongle, and I redirect the Led output in GPIO6.

    see the code below:

    void IO_Init(void)

    {

    /* P9.0, P9.1, P9.2 and P9.3 output*/ /*modify for STR9x dongle Fabio*/

    GPIO_StructInit(&GPIO_InitStructure);

    GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3;

    GPIO_InitStructure.GPIO_Direction=GPIO_PinOutput;

    GPIO_InitStructure.GPIO_Type=GPIO_Type_PushPull;

    GPIO_InitStructure.GPIO_IPConnected=GPIO_IPConnected_Disable;

    GPIO_Init(GPIO6,&GPIO_InitStructure);

    /* P5.0 alternate input 1, CAN_RX pin 12*/

    GPIO_StructInit(&GPIO_InitStructure);

    GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0;

    GPIO_InitStructure.GPIO_Direction=GPIO_PinInput;

    GPIO_InitStructure.GPIO_Type=GPIO_Type_PushPull;

    GPIO_InitStructure.GPIO_IPConnected=GPIO_IPConnected_Enable;

    GPIO_InitStructure.GPIO_Alternate=GPIO_InputAlt1;

    GPIO_Init(GPIO5,&GPIO_InitStructure);

    /* P3.6 alternate output 2, CAN_TX pin 66*/

    GPIO_StructInit(&GPIO_InitStructure);

    GPIO_InitStructure.GPIO_Pin=GPIO_Pin_6;

    GPIO_InitStructure.GPIO_Direction=GPIO_PinOutput;

    GPIO_InitStructure.GPIO_Type=GPIO_Type_PushPull;

    GPIO_InitStructure.GPIO_IPConnected=GPIO_IPConnected_Enable;

    GPIO_InitStructure.GPIO_Alternate=GPIO_OutputAlt3;

    GPIO_Init(GPIO3,&GPIO_InitStructure);

    // The code below made the led lit!!!!

    SCU->GPIOOUT[6] = 0x0055;

    SCU->GPIOTYPE[6] = 0x0F;

    GPIO6->DDR = 0x0F;

    GPIO6->DR[0x0F*4] = 0x0F;

    ---Using this last 4 lines the led start to lid. But with the previous initialization they don't lid.

    Also I put in C:\keil\ARM\INC\St\91x the new .h included in V1.2 lib

    Hello Ibtissem!

    runblade

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:44

    Quote:

    /* P9.0, P9.1, P9.2 and P9.3 output*/ /*modify for STR9x dongle Fabio*/

    GPIO_StructInit(&GPIO_InitStructure);

    GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3;

    GPIO_InitStructure.GPIO_Direction=GPIO_PinOutput;

    GPIO_InitStructure.GPIO_Type=GPIO_Type_PushPull;

    GPIO_InitStructure.GPIO_IPConnected=GPIO_IPConnected_Disable; //IPConnected_Disable

    GPIO_Init(GPIO6,&GPIO_InitStructure); // need to be GPIO9

    /* P5.0 alternate input 1, CAN_RX pin 12*/

    ... all right

    /* P3.6 alternate output 2, CAN_TX pin 66*/ // OutputAlt3!!!

    GPIO_StructInit(&GPIO_InitStructure);

    GPIO_InitStructure.GPIO_Pin=GPIO_Pin_6;

    GPIO_InitStructure.GPIO_Direction=GPIO_PinOutput;

    GPIO_InitStructure.GPIO_Type=GPIO_Type_PushPull;

    GPIO_InitStructure.GPIO_IPConnected=GPIO_IPConnected_Enable; //need to be IPConnected_Disable, if it is output

    GPIO_InitStructure.GPIO_Alternate=GPIO_OutputAlt3;

    ...

    // The code below made the led lit!!!!

    SCU->GPIOOUT[6] = 0x0055;

    SCU->GPIOTYPE[6] = 0x0F;

    GPIO6->DDR = 0x0F;

    GPIO6->DR[0x0F*4] = 0x0F;

    ---Using this last 4 lines the led start to lid. But with the previous initialization they don't lid.

    What port do you use GPIO6 or GPIO9?

    Best regards

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 09:44

    GPIO6

    runblade