Exploring CW32L010: DAPLink Utility Adds Programming Support for Wuhan Xinyuan CW32 Series Chips and Custom Programming Algorithm for Option Bytes

Exploring CW32L010: DAPLink Utility Adds Programming Support for Wuhan Xinyuan CW32 Series Chips and Custom Programming Algorithm for Option Bytes

Exploring CW32L010: DAPLink Utility Adds Programming Support for Wuhan Xinyuan CW32 Series Chips and Custom Programming Algorithm for Option Bytes

Introduction to Wuhan Xinyuan CW32

Wuhan Xinyuan Semiconductor is a wholly-owned subsidiary of the publicly listed Wuhan Liyuan Information Technology Co., Ltd., primarily focused on motor control MCUs. Currently, they have released:

  • • General-purpose high-performance CW32F003/030 series
  • • Secure low-power CW32L083/031/052 series
  • • Ultra-low-cost CW32L010/011/012 high-frequency (96MHz) low-power series
  • • Wireless RF CW32W031 series products

The CW32L010ESC_Driver motor driver board is a low-cost BLDC (Brushless DC) motor development board launched by the Wuhan Xinyuan Semiconductor ecosystem community.

It can be used in products such as electric drills, fascia guns, and smart cars.

It can drive motors up to 11W (provided the motor, power supply, etc. meet the requirements), and can be used for DIY high-power fans.

Previously, I applied for the CW32F003 and CW32F031 development boards from the Wuhan Xinyuan official website, and this time I obtained the CW32L010 and L011 small development boards. This time, the DAPLink Utility has added programming support for the entire CW32 series chips, and a custom programming algorithm for option bytes has been developed. The offline programmer EasyFlaser-META will also support offline programming and option byte configuration programming.

CW32L010 Read Protection

All CW32 series chips from Wuhan Xinyuan do not have option bytes, only read protection settings, which are quite simple to configure. Taking the CW32L010 as an example, this chip supports four protection modes:

  • • Level 0: ISP readable and writable, SWD readable and writable
  • • Level 1: ISP can be downgraded, SWD can be downgraded, data cannot be read out
  • • Level 2: ISP can be downgraded, SWD has no function, data cannot be read out
  • • Level 3: ISP has no function, SWD has no function, data cannot be read out

Levels 1 and 2 have the same protection capability, with the difference that Level 1 can be released via SWD, while Level 2 can only be released using ISP with a serial port and official tools. Therefore, for convenience, it is recommended to use Level 1 during project development, as this avoids the need to switch tools back and forth, especially since development and debugging still require using SWD to program the application.

Important Note!!! The number of times the read protection level can be modified for this chip is limited to 48 times! After exceeding 48 modifications, further changes will be ineffective!

The official code for changing the read protection level has been provided, and it is relatively simple to set up:

/**
 * @brief Get the current read protection level
 *
 * @return uint8_t  :0/1/2/3
 */
uint8_t FLASH_GetReadOutLevel(void)
{
    return(CW_FLASH->CR1_f.SECURITY);
}

/**
 * @brief Set the MCU's read protection level, valid values for RdLevel are 0,1,2,3
 * //After writing the level to the MCU, the MCU will automatically restart and complete the modification of the read protection level
 * //If changing from a non-0 level to level 0, the MCU will erase all data in FLASH
 * //Level 0: ISP readable and writable, SWD readable and writable
 * //Level 1: ISP can be downgraded, SWD can be downgraded; data cannot be read out
 * //Level 2: ISP can be downgraded, SWD has no function; data cannot be read out
 * //Level 3: ISP has no function, SWD has no function; data cannot be read out
 * @param RdLevel  : FLASH_RDLEVEL0   FLASH_RDLEVEL1
 *                 : FLASH_RDLEVEL2   FLASH_RDLEVEL3
 */
void FLASH_SetReadOutLevel(uint16_t RdLevel)
{
    assert_param(IS_FLASH_RDLEVEL(RdLevel));
    if(FLASH_GetReadOutLevel() != RdLevel)
    {
        RdLevel = 0x5A50 | (RdLevel & 0x03u);
        *((volatile uint32_t*)(0x4000431C)) = RdLevel;
        *((volatile uint32_t*)(0x40004370)) = 0x5A5AABCD;   //MCU restarts to update read protection level
        while(1);   //MCU restarts to update protection level
    }
}

Online Programming

Exploring CW32L010: DAPLink Utility Adds Programming Support for Wuhan Xinyuan CW32 Series Chips and Custom Programming Algorithm for Option Bytes

Offline Programming

For those in need, you can purchase from the following Taobao stores:

  • Xingyi Studio
  • He Wen Intelligent Technology Enterprise Store

Make your purchase~~~

Exploring CW32L010: DAPLink Utility Adds Programming Support for Wuhan Xinyuan CW32 Series Chips and Custom Programming Algorithm for Option Bytes

Exploring CW32L010: DAPLink Utility Adds Programming Support for Wuhan Xinyuan CW32 Series Chips and Custom Programming Algorithm for Option Bytes

ends…

Leave a Comment