bigdragon1977 / stm32flash

Automatically exported from code.google.com/p/stm32flash
0 stars 0 forks source link

More then two bytes sent #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I built the tool on a mc tonight.
When I run it against a couple of STM32 boards I have here, for each I get the 
same result:

stm32flash - http://stm32flash.googlecode.com/

Serial Config: 57600 8E1
More then two bytes sent in the PID, unknown/unsupported device

the Python loader script works just fine on the same devices.

Any ideas?

Original issue reported on code.google.com by micromou...@gmail.com on 27 Jul 2011 at 12:01

GoogleCodeExporter commented 9 years ago
It would be helpful if you'd said what parts you've got, there are many 
different chips in the STM32 family.

Original comment by mishg...@gmail.com on 29 Jul 2011 at 1:13

GoogleCodeExporter commented 9 years ago
Yes, sorry.

This is with STM32F103RBT6 parts. Both are Revision B devices. They are mounted 
o an IAR STM32-SK board and an Olimex STM32-P103 board.

Original comment by micromou...@gmail.com on 29 Jul 2011 at 6:51

GoogleCodeExporter commented 9 years ago
That's very odd. I can't see any mention of any parts- and least of all the 
F103, returning a PID in anything other than two bytes.

Sorry if I'm being thick, but "built the tool on a mc"? What's an mc?

And to double check, there's something else missing from your report, which is 
what command you ran. I'd rather not guess. Remember that no-one is watching 
what you do, so if you don't spell it out, they'll never know. If you've ever 
had problems getting people to help you before, this is probably why- don't 
make the internet work any harder than it has to- I for one am pretty lazy when 
I'm not being paid :)

Can you replace the line:
  fprintf(stderr, "More than two bytes sent in the PID, unknown/unsupported device\n");
with
  fprintf(stderr, "More than two bytes sent in the PID (0x%02x), unknown/unsupported device\n", len);

in stm32.c and recompile, re-run it, and let me know what it says?

Original comment by mishg...@gmail.com on 30 Jul 2011 at 2:40

GoogleCodeExporter commented 9 years ago
Apologies for the delay. I am on and off holidays at the moment.

My message should have read built on a mac ( OS X Snow Leopard 10.6 - 64 bit) 
rather than mc. Typing is not one of my best talents.

The command line is simply:

to try and ascertain the device identity.

After replacing the line you suggest, the output returns:

"More than two bytes sent in the PID (0x04), unknown/unsupported device"

Original comment by micromou...@gmail.com on 12 Aug 2011 at 9:58

GoogleCodeExporter commented 9 years ago
Hi, 
i found out that the medium-density performance line of the stm32 takes up to 4 
bytes of PID.
I currently using the STM32F103x with PID 0x06410041, so for a quickand dirty 
fix you can add this line to the devices table 

{0x641, "Medium_Density Performance Line" , 0x20000200, 0x00005000, 0x08000000, 
0x08020000,  4,  1024, 0x1FFFF800, 0x1FFFF80F, 0x1FFFF000, 0x1FFFF800}, 

and dump the additional two bytes:

/* get the device ID */
    if (!stm32_send_command(stm, stm->cmd->gid)) {
        stm32_close(stm);
        return NULL;
    }
    len = stm32_read_byte(stm) + 1;
    if (len != 2) {
        //stm32_close(stm);
        fprintf(stderr, "More then two bytes sent in the PID (0x%02x), unknown/unsupported device\n",len);
        //return NULL;
    }
    stm->pid = (stm32_read_byte(stm) << 8) | stm32_read_byte(stm);
  fprintf(stderr, "Read PID: 0x%04x\n",stm->pid);
  uint8_t dump1 = stm32_read_byte(stm);
  uint8_t dump2 = stm32_read_byte(stm);

  fprintf(stderr, "Dumped 2 bytes: 0x%02x 0x%02x\n", dump1,dump2);
    if (stm32_read_byte(stm) != STM32_ACK) {
        stm32_close(stm);
    fprintf(stderr, "no ACK\n");
        return NULL;
    } else fprintf(stderr, "Read ACK\n");

Original comment by kubi...@informatik.hu-berlin.de on 13 Dec 2011 at 3:05

Attachments:

GoogleCodeExporter commented 9 years ago
In absence of the maintainer, I have set up a git repository where I will try 
to incorporate all outstanding patches: 
https://gitorious.org/stm32flash/stm32flash#more

I made an alternative patch for this issue, in the "issue10" branch. It would 
be nice if you could verify that it works on this device.

Original comment by lists.to...@gmail.com on 17 Nov 2012 at 8:38

GoogleCodeExporter commented 9 years ago
This has now been fixed in the official repository and is included in version 
0.3beta2.

Original comment by lists.to...@gmail.com on 9 Dec 2013 at 11:09