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

ST-LINK fails to be detected!

Hi
I have been working with ST-Link V2 programmer to program STM32L1 discovery board.
after a month or so yesterday I faces a problem I get error when trying to download the flash:
"Flash download failed-Target dll has been canceled"
in tools in debug window I see this "No Cortex-M SW Device Found"
Max clock is on 1MHz. Any one knows what the problem is!!
Could it be related to the software license? cause I used another ST-LINK V2 and the problem exists.

  • What I myself think about the mentioned problem is that the last program I downloaded to flash has made such a problem, is it possible or it cannot related to the program written? I added the part below:

    #define    DP_0      GPIO_Pin_13  //PC13
    #define    DP_1      GPIO_Pin_14  //PC14
    #define    DP_2      GPIO_Pin_15  //PC15
    #define    DP_3      GPIO_Pin_0   //PC0
    #define    DP_4      GPIO_Pin_1   //PC1
    #define    DP_5      GPIO_Pin_2   //PC2
    #define    DP_6      GPIO_Pin_3   //PC3
    #define    DP_7      GPIO_Pin_2   //PB2
    //lcd control port
    #define    CS1          GPIO_Pin_10   //PB10
    #define    CS2          GPIO_Pin_11   //PB11
    #define    CS3          GPIO_Pin_12   //PB12
    #define    RS           GPIO_Pin_13   //PB13
    #define    RW           GPIO_Pin_14   //PB14
    #define    EN           GPIO_Pin_15   //PB15
    

    //-------------------------------------------------------------------------------------------------
    // Universal KS0108 driver library
    // STM32 MCU low-level driver
    // (c) Rados³aw Kwiecieñ, radek@dxp.pl
    //-------------------------------------------------------------------------------------------------
    //#include "stm32f10x_lib.h"
    #include "stm32l1xx.h"
    #include "lcd_pin_function.h" #define KS0108_PORT GPIOA #define KS0108_RS GPIO_Pin_4
    #define KS0108_RW GPIO_Pin_5
    #define KS0108_EN GPIO_Pin_6 #define KS0108_CS1 GPIO_Pin_2
    #define KS0108_CS2 GPIO_Pin_3
    #define KS0108_CS3 GPIO_Pin_7 #define KS0108_D0 0 #define DISPLAY_STATUS_BUSY 0x80 extern unsigned char screen_x;
    extern unsigned char screen_y; GPIO_InitTypeDef GPIO_InitStructure; void Set_Dataport(unsigned char Data) //this function converts a hex data PD to a data ready to be written in //PC13,PC14,PC15,PC0,PC1,PC2,PC3,PB2 , LCD data port
    { GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = DP_0|DP_1|DP_2|DP_3|DP_4|DP_5|DP_6; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType=GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_UP ; GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = DP_7; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType=GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_UP ; GPIO_Init(GPIOB, &GPIO_InitStructure); if (Data & 1<<0) GPIO_SetBits(GPIOC, DP_0); else GPIO_ResetBits(GPIOC, DP_0); if (Data & 1<<1) GPIO_SetBits(GPIOC, DP_1); else GPIO_ResetBits(GPIOC, DP_1); if (Data & 1<<2) GPIO_SetBits(GPIOC, DP_2); else GPIO_ResetBits(GPIOC, DP_2); if (Data & 1<<3) GPIO_SetBits(GPIOC, DP_3); else GPIO_ResetBits(GPIOC, DP_3); if (Data & 1<<4) GPIO_SetBits(GPIOC, DP_4); else GPIO_ResetBits(GPIOC, DP_4); if (Data & 1<<5) GPIO_SetBits(GPIOC, DP_5); else GPIO_ResetBits(GPIOC, DP_5); if (Data & 1<<6) GPIO_SetBits(GPIOC, DP_6); else GPIO_ResetBits(GPIOC, DP_6); if (Data & 1<<7) GPIO_SetBits(GPIOB, DP_7); else GPIO_ResetBits(GPIOB, DP_7);
    } void Reset_Dataport(unsigned char Data) //this function converts a hex data PD to a data ready to be written in //PC13,PC14,PC15,PC0,PC1,PC2,PC3,PB2 , LCD data port
    { GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = DP_0|DP_1|DP_2|DP_3|DP_4|DP_5|DP_6; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType=GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_UP ; GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = DP_7; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType=GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_UP ; GPIO_Init(GPIOB, &GPIO_InitStructure); if (Data & 1<<0) GPIO_ResetBits(GPIOC, DP_0); //else GPIO_ResetBits(GPIOC, DP_0); if (Data & 1<<1) GPIO_ResetBits(GPIOC, DP_1); //else GPIO_ResetBits(GPIOC, DP_1); if (Data & 1<<2) GPIO_ResetBits(GPIOC, DP_2); //else GPIO_ResetBits(GPIOC, DP_2); if (Data & 1<<3) GPIO_ResetBits(GPIOC, DP_3); //else GPIO_ResetBits(GPIOC, DP_3); if (Data & 1<<4) GPIO_ResetBits(GPIOC, DP_4); //else GPIO_ResetBits(GPIOC, DP_4); if (Data & 1<<5) GPIO_ResetBits(GPIOC, DP_5); //else GPIO_ResetBits(GPIOC, DP_5); if (Data & 1<<6) GPIO_ResetBits(GPIOC, DP_6); //else GPIO_ResetBits(GPIOC, DP_6); if (Data & 1<<7) GPIO_ResetBits(GPIOB, DP_7); //else GPIO_ResetBits(GPIOB, DP_7);
    } //-------------------------------------------------------------------------------------------------
    // Delay function /for 8MHz/
    //-------------------------------------------------------------------------------------------------
    void GLCD_Delay(void)
    { // asm("nop");asm("nop");asm("nop");asm("nop"); __nop();__nop();__nop();__nop();
    } //-------------------------------------------------------------------------------------------------
    // Enalbe Controller (0-2)
    //-------------------------------------------------------------------------------------------------
    void GLCD_EnableController(unsigned char controller)
    { switch(controller){ case 0 : RESET_CS1; break; case 1 : RESET_CS2; break; case 2 : RESET_CS3; break; }
    } //-------------------------------------------------------------------------------------------------
    // Disable Controller (0-2)
    //-------------------------------------------------------------------------------------------------

  • W atch that you didn't break the PA13/PA14 pins in a prior iteration, or somewhere else in the code. This would disconnect the debug interface.

  • Dear Westonsupermare,
    I did not use any of PA13 and PA14 pins.
    I had another STM32L discovery board of same type I programmed it with another firmware and saw that it is no longer able to be programmed. how ever they work properly by their last firmware now. the ST-LINK programmer is okay since I can program Discovery board for STM32f103RE.
    Is there any way to make my faulty boards back to their early state?
    I remember in AVR I had same problem when fusebits set by fault so I need to give an external clock!
    But I don't know is there some way like that?

  • You can link/jumper the BOOT(BOOT0) pin and VDD (3V), and restart the board, in this state it won't be running any of your code, and you should be able to erase it.

  • Thank you very much for your help!
    I did what you said and the problem solved. Many many thanks.