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

baremetal-ch32v003 is not working after power off and resume. #76

Open
RhonyD opened this issue Nov 14, 2024 · 6 comments
Open

baremetal-ch32v003 is not working after power off and resume. #76

RhonyD opened this issue Nov 14, 2024 · 6 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@RhonyD
Copy link

RhonyD commented Nov 14, 2024

I build and flashed [‎baremetal-ch32v003]. Everything worked flawlessly, but as soon as I switched off the power and resumed everything stopped, no blink nothing. Please help.

@Rockwell1799
Copy link

I build and flashed [‎baremetal-ch32v003]. Everything worked flawlessly, but as soon as I switched off the power and resumed everything stopped, no blink nothing. Please help.

Can you give more info like a picture of the board you're using and post the code here!

@maxgerhardt
Copy link
Member

Not reproducable at all for me. I tested this with my ch32v003f4p6_evt_r0 environment and WCH-LinkE, flashed the board

Checking size .pio\build\ch32v003f4p6_evt_r0\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  12.5% (used 256 bytes from 2048 bytes)
Flash: [          ]   3.1% (used 516 bytes from 16384 bytes)
Configuring upload protocol...
AVAILABLE: isp, minichlink, wch-link, wlink
CURRENT: upload_protocol = wch-link
Uploading .pio\build\ch32v003f4p6_evt_r0\firmware.elf
Open On-Chip Debugger 0.11.0+dev-02415-gfad123a16-dirty (2024-07-29-15:30)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

Warn : Transport "sdi" was already selected
Ready for Remote Connections
[wch_riscv.cpu.0] Target successfully examined.
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked
===========================[SUCCESS] Took 3.08 seconds ===========================

Then unplugged the WCH-LinkE (to which the ch32v003 is connected to) and plugged it back in, the LED is still blinking!

@maxgerhardt maxgerhardt added help wanted Extra attention is needed question Further information is requested labels Nov 14, 2024
@RhonyD
Copy link
Author

RhonyD commented Nov 15, 2024

Thanks for you kind and prompt reply. Actually I was trying with a bare minimum board with a tssop adapter which is powered up using a AS1117 3v regulator. After your reply I took out the mini dev board which is a readymade development for CH32v003 and flashed the same code and it worked flawlessly. So the finding is that my bareminimum board is the culprit. I have redesigned a bareminimum board and now it's working perfectly, thanks again for your reply.

@RhonyD
Copy link
Author

RhonyD commented Nov 15, 2024

if somehow the use of RAM can be reduced then it would be great. In case of CHFUN framework the usage of RAM is very less.

@RhonyD
Copy link
Author

RhonyD commented Nov 15, 2024

Another issue which I am facing is while trying to make my own lib file like the one which is given below:-
GPIO_CONFIG.h

#ifndef _GPIO_CONIFG_H
#define _GPIO_CONIFG_H
#include "ch32v00x.h"

#define u8      uint8_t

#define GPIO_PORT  GPIOD
#define GPIO_PIN    3
#define GPIO_PIN_1  2

void GPIO_INIT(uint8_t PIN);

#endif

and corresponding source file GPIO_CONFIG.c-

#include "GPIO_CONFIG.h"


void GPIO_INIT(u8 PIN)
{
    RCC->APB2PCENR&=~(RCC_APB2Periph_GPIOD);	
	GPIO_PORT->CFGLR &= ~(0xf<<(4*PIN));
	RCC->APB2PCENR|=(RCC_APB2Periph_GPIOD);	
	GPIO_PORT->CFGLR &= ~(0xf<<(4*PIN));
	GPIO_PORT->CFGLR |=(GPIO_CNF_OUT_PP|GPIO_Speed_50MHz)<<(4*PIN);

}

and then include #include "GPIO_CONFIG.h" in main.Now if I try building complier shows Error " "ch32v00x.h" No such file found.

what's the issue?

@maxgerhardt
Copy link
Member

grafik

Not reproducable at all. Please post the full project files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants