Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CH32X035F7P6 incorrect code flash size #18

Open
nikitos1550 opened this issue Jul 21, 2024 · 8 comments
Open

CH32X035F7P6 incorrect code flash size #18

nikitos1550 opened this issue Jul 21, 2024 · 8 comments

Comments

@nikitos1550
Copy link

nikitos1550 commented Jul 21, 2024

The chip has 62K as other in x035 series.
62K is mentioned in pdf files and x035 page desciption (WCH website), same time chips list page says it is 48K, that
seem to be typo.

        {
                .name = "CH32X035F7P6",  
                .family = 0x23,
                .type = 0x57,   
                .code_flash_size = 49152, // ----> 62K !
                .mcu_id_len = 8,
                .clear_cfg_rom_read = true,
                .need_remove_wp = true,
                .need_last_write = true,
        },
@nikitos1550
Copy link
Author

There is new code:

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0
# Copyright 2024 Frank Zago


# Generate chips.h from upstream wcfg files

import configparser

Where wcfg files can be obtained?

@frank-zago
Copy link
Owner

frank-zago commented Jul 21, 2024

The wcfg files are part of the official WCHISPTool from wch.
https://www.wch-ic.com/downloads/WCHISPTool_Setup_exe.html

@frank-zago
Copy link
Owner

I can make a patch for that, but since you have that chip, could you check whether you can actually flash a 62KB file?

@frank-zago
Copy link
Owner

The CH32L103F7P6 is also listed as having 48KB, while the others in that family have 64KB, so this might be correct and the docs are wrong.

@nikitos1550
Copy link
Author

I already checked, but with random 62K data.
Here is closed PR #17 with log from my console.

@nikitos1550
Copy link
Author

Well, I can think that typo in doc also possible. Let postpone this issue for a while, I have plans to code some test for ch32x035, I will also make some test that will check actual flash size.

@nikitos1550
Copy link
Author

nikitos1550 commented Aug 3, 2024

I just come to ch32x035 EVT and first applications.

/* Flash Program Valid Address */
#define ValidAddrStart             (FLASH_BASE)
#define ValidAddrEnd               (FLASH_BASE + 0xF800)

EVT has same settings for all chips (all family). 0xF800 is 62K.

Also there is only one link script for all chips.

FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 62K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K

Later I can proof it with some application, but seems WCH util has some mistake or error.

@nikitos1550
Copy link
Author

I asked vendor about this, the answer was that there actually two versions, 48k and 62k! 48k is old one.
We can read specific register to understand what version we are using.
I will try check are there any ability to check that register via bootloader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants