I discovered nRST pin can also be disabled in the TSSOP20 package using IOMUX - it becomes
PA0!
Though the manual says PROHIBITED, nothing is more appealing than trying forbidden stuff
Be careful with this, if you disable nRST and also SWC/SWD, it'll be converted to OTP, ask me how I discovered it!
.
You might power it with nRST down, and y eah it won't init, but will have to release it at some point, to let the programmer do it's stuff, the only way woudl be with some really accurate timing. I wasn't able to connect - ever, another $0.25 to the trash.
If you do this, remember to implement some " mode", where pressing a button or making some jumper skips the reset disabling.
if(!ReadPin(BTN)){ // Enter safe mode if button pressed at startup (Initialize button IO port first!)
while(1){
Toggle(GREEN);
delayms(100);
}
}
// Disable RST pin
RCC_APB1PeriphClockCmd(RCC_APB1Periph_IOMUX, ENABLE); // Enable IOMUX
GPIOMUX->NRST_PIN_KEY = NRST_PINKEY; // Write NRST Pin key
GPIOMUX->NRST_PA0_SEL |= 1; // NRST = PA0 (Pin 4 TSSOP20)
Below you can see how the mcu only needs 700us from nRST release to start and initialize everything, while the J-Link delays the communication for 50ms.
Edit:
This chip definitely seems the same as the Hk32F0301M, which adds few features (But LSI runs at 48MHz)
Setting Standby mode worked (Measured ~1uA, didn't tried further), also the SAWU (Standby timer) works.
Tweaking flash wait states and HSICAL, I got this little thing running quite fast!
- 0 wait states, 52MHz (HSICAL= 0x2C)
- 1 wait states, 104MHz (HSICAL= 0x39)
- 2 wait states, 144MHz (HSICAL= 0x3D)
HSICAL=0x3F does 200MHz
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, 2); // 2 flash wait states
MODIFY_REG(RCC->CR, RCC_CR_HSICAL, 0x3D<<RCC_CR_HSICAL_Pos); // This generates ~144MHz
However when heating the mcu slighly, it caused HardFault, so not stable for everyday use.
While torturing the chip with the hot iron tip, I got these stable values:
- 0 wait states, 48MHz (HSICAL= 0x2A)
- 1 wait states, 96MHz (HSICAL= 0x38)
- 2 wait states, 108MHz (HSICAL= 0x3A) <--Not worth it. Reaching the chip limit?
Crazy!