Skip to main content
Visitor II
April 29, 2024
Solved

Blue pill (STM32F1) programs OK via Arduino IDE but not Keil. Chip ID:0x2BA01477

  • April 29, 2024
  • 13 replies
  • 20870 views

I am trying to program STM32 Blue pill board using Keil, and it gives the following error: "Connection refused due to device mismatch; Device connected to debug unit is different from device selected for project target STMicroelectronics STM32F103C8." I am using ST-Link debugger for programming as it does not have on-board ST-debugger. The issue is that it reads chip ID:0x2BA01477, which, I have read on other forums, is the ID read when your board uses clone instead of real STM32F103C8T6. Still, I want to program it using Keil. When I program the same setup using Arduino IDE, it is gets programmed in a perfectly fine way. Is there any other way to resolve this error in Keil using the same board or there is no other option left but to replace the board?

    This topic has been closed for replies.
    Best answer by Andrew Neil

    @IMumt.1 wrote:

    I agree to your suggestion 


    I think it might also have been suggested by others ... ?

    :thinking_face:

     


    @IMumt.1 wrote:

     I have borrowed a Nucleo board, from my friend, for experimentation. 


    Excellent choice!

    :thumbs_up::clapping_hands:

    Now please mark the solution.

     

    PS

    I don't think you ever answered this question:

     


    @Andrew Neil wrote:

    @IMumt.1 wrote:

     When I program the same setup using Arduino IDE, it is gets programmed in a perfectly fine way. 


    Is that using an ST-Link (or any other SWD programmer), or the Arduino serial bootloader ?



    https://community.st.com/t5/stm32-mcus-products/blue-pill-stm32f1-board-gets-programmed-through-arduino-ide-but/m-p/667932/highlight/true#M242510

     

    If you were using the Arduino serial bootloader, that would explain why the Arduino IDE could program successfully.

     

    13 replies

    Technical Moderator
    April 29, 2024

    The only solution is actually to use both a genuine ST-LINK and a genuine STM32F103.

    Regards
    /Peter

    Super User
    April 29, 2024

    @IMumt.1 wrote:

     When I program the same setup using Arduino IDE, it is gets programmed in a perfectly fine way. 


    Is that using an ST-Link (or any other SWD programmer), or the Arduino serial bootloader ?

     


    @IMumt.1 wrote:

    The issue is that it reads chip ID:0x2BA01477, which, I have read on other forums, is the ID read when your board uses clone instead of real STM32F103C8T6. 


    Yes, it is highly likely that these "Pill" boards will use fake/clone chips - that's why they're cheap!

    Did the "other forums" not offer any suggestions in how to get around this?

    Maybe Keil has an option to support them, or to ignore the device ID? You'd have to ask Keil about that.

    Clearly, ST aren't going to be keen to support fakes/clones here on their forum!

     

    IMumt.1Author
    Visitor II
    May 2, 2024

    Arduino IDE is using ST-Link for programming. The same debugger setup using ST-link which is not being programmed, is being programmed using Arduino IDE.I repeat, the hardware setup is exactly the same in Keil and Arduino IDE but one works and other does not!

    Super User
    May 2, 2024

    It's been established that the reason Keil won't program the board is exactly as it says in its error message - you have the wrong chip on the board!

    https://community.st.com/t5/stm32-mcus-products/blue-pill-stm32f1-board-gets-programmed-through-arduino-ide-but/m-p/668310/highlight/true#M242621 

     

    Presumably, the Arduino IDE just doesn't make that check.

    The Arduino IDE forum would be the bast place to ask about that:

    https://forum.arduino.cc/c/software/ide-2-x/93

     

    Super User
    April 29, 2024

    Maybe you can work with Keil , if you select the chip, thats real on Blue pill board .

    If GD32F103C8 , you should set this as target...just look, what you have.

    IMumt.1Author
    Visitor II
    April 29, 2024

    On board it's STM32F103

    Super User
    April 29, 2024

    Can you show a good picture of the cpu on this board ?

    btw

    ID: 0x2BA01477  is CS32F103C8T6  by CKS .

    Super User
    April 29, 2024
    Technical Moderator
    April 29, 2024

    @IMumt.1 ...whereby the marking with this text says absolutely nothing about whether it is an original or a fake. For STM32F103 in particular, third-party labelling is ground off/etched off and a fake marking is applied. You can only recognise this with tools that measure into the STM32F103, such as those mentioned by @Andrew Neil.

    Technical Moderator
    April 29, 2024

    At least the counterfeiter has omitted the ST logo. 

    IMumt.1Author
    Visitor II
    April 30, 2024

    Now that I have bought a genuine STM32 board, still it shows the wrong Chip ID in keil. I want to confirm, whether there is some issue in keil Configuration or the issue is with the board?

     

    Super User
    April 30, 2024

    So check connection with Stm32CubeProgrammer,

    maybe set : 

    AScha3_0-1714465318660.png

    and show screenshot (what it telling about target ) -then we see. 

     

    btw

    chip on new BluePill looks "good" , original . (But only connection telling the truth ! )

    IMumt.1Author
    Visitor II
    April 30, 2024

    I am using ST-Link debugger for programming it.

    Technical Moderator
    April 30, 2024

    What kind of board did you buy?

    Do you have a photo of it?

    IMumt.1Author
    Visitor II
    April 30, 2024

    STM32 frontSTM32 frontSTM32 backSTM32 back

    Technical Moderator
    April 30, 2024

    This is one of these so-called Blue Pills.

    The probability that you will find such a Blue Pill with a genuine STM32F103 has been close to zero for years. Forget the Blue Pills and buy a NUCLEO, e.g. the NUCLEO-F103RB, they are (so far) only available as genuine variants.

    Super User
    April 30, 2024

    @Peter BENSCH wrote:

    Forget the Blue Pills and buy a NUCLEO, e.g. the NUCLEO-F103RB, they are (so far) only available as genuine variants.


    ^^^^^ This !! ^^^^^

    Surely, by now, it has been amply demonstrated that the Blue Pill is a timewaster - it is a false economy.

    Even if you do actually manage to find out what the chip on your board really is, and you do manage to configure Keil to recognise it, you will still have no guarantee as to how well - if at all - it will actually work!

     

    #BluePill #BlackPill #Fake #Clone #JustSayNO

    Technical Moderator
    April 30, 2024

    It's always the same: if you buy cheap, you buy twice. Or even more often.