Skip to content
Snippets Groups Projects
Commit 72cd014f authored by Alexander Mandera's avatar Alexander Mandera
Browse files

Use binary blob write for whole 20x/30x series

parent 7a12cf5c
No related branches found
No related tags found
No related merge requests found
No preview for this file type
...@@ -236,11 +236,13 @@ static int LESetupInterface( void * d ) ...@@ -236,11 +236,13 @@ static int LESetupInterface( void * d )
return -1; return -1;
} }
uint32_t target_chip_type = ( rbuff[4] << 4) + (rbuff[5] >> 4); uint32_t mcu_series = rbuff[4] << 4;
fprintf(stderr, "Chip Type: %03x\n", target_chip_type); uint32_t target_chip_type = mcu_series + (rbuff[5] >> 4);
if( target_chip_type == 0x307 || target_chip_type == 0x203 ) fprintf(stderr, "Chip Type: %03x\n", target_chip_type);
if( mcu_series == 0x300 || mcu_series == 0x200 )
{ {
fprintf( stderr, "CH32V307 or CH32V203 Detected. Allowing old-flash-mode for operation.\n" ); fprintf( stderr, "CH32V30x or CH32V20x MCU detected. Using binary blob write for operation.\n" );
MCF.WriteBinaryBlob = LEWriteBinaryBlob; MCF.WriteBinaryBlob = LEWriteBinaryBlob;
iss->sector_size = 256; iss->sector_size = 256;
...@@ -401,7 +403,7 @@ void * TryInit_WCHLinkE() ...@@ -401,7 +403,7 @@ void * TryInit_WCHLinkE()
#if 1 #if 1
// In case you are using a non-CH32V003 board. // Flash Bootloader for V20x and V30x series MCUs
const uint8_t * bootloader = (const uint8_t*) const uint8_t * bootloader = (const uint8_t*)
"\x93\x77\x15\x00\x41\x11\x99\xcf\xb7\x06\x67\x45\xb7\x27\x02\x40" \ "\x93\x77\x15\x00\x41\x11\x99\xcf\xb7\x06\x67\x45\xb7\x27\x02\x40" \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment