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

SDI not working with WCH-Link v2.11 (WCH-LinkE-CH32V305) #41

Open
thirstyone opened this issue Nov 23, 2023 · 8 comments
Open

SDI not working with WCH-Link v2.11 (WCH-LinkE-CH32V305) #41

thirstyone opened this issue Nov 23, 2023 · 8 comments
Labels
question Further information is requested

Comments

@thirstyone
Copy link

here are the last lines:

14:30:19 [INFO] Now connect to the WCH-Link serial port to read SDI print
er computer software

(found these lines in the end of WCH-LinkE-APP-IAP.bin)

@andelf
Copy link
Contributor

andelf commented Nov 23, 2023

I've seen this error while developing the feature.
If data0 is not configured properly, the UART link will print(It's almost always corrupted text):

Please check the SDl, and Enable this function through the upper computer software

  • A common pitfall is misuse of little endian and big endian while writing data0.
  • And meanwhile, data0 should be written in 32-bit word, not byte-by-byte
  • Write data1, then data0

@andelf andelf added the question Further information is requested label Nov 23, 2023
@thirstyone
Copy link
Author

Could you please provide a working example of SDI print? After a while I get a bricked mcu (the second time!), so that I have to revert to the original wch link utility to " clear all code flash - by power off". (BTW, is it possible to add such a feature to this wlink?)

@thirstyone
Copy link
Author

btw, have you checked this feature with v2.11?

@andelf
Copy link
Contributor

andelf commented Nov 24, 2023

Checkout: https://github.com/ch32-rs/ch32v00x-hal/blob/main/src/debug.rs
And: https://github.com/ch32-rs/ch32v00x-hal/blob/main/examples/debug.rs

> wlink erase --help
Erase flash

Usage: wlink erase [OPTIONS]

Options:
      --method <METHOD>
          Erase mode

          [default: default]

          Possible values:
          - power-off: Erase code flash by power off, the probe will power off the target chip
          - pin-rst:   Erase code flash by RST pin, the probe will active the nRST line. Requires a RST pin connection
          - default:   Erase code flash by probe command
....

@kaidegit
Copy link

Could you please provide a working example of SDI print? After a while I get a bricked mcu (the second time!), so that I have to revert to the original wch link utility to " clear all code flash - by power off". (BTW, is it possible to add such a feature to this wlink?)

https://www.wch.cn/bbs/thread-107881-1.html

@thirstyone
Copy link
Author

ha! I should have checked that earlier (i mean erase --help)
However:
CH32V003-makefile-example-main % wlink erase --method power-off --chip ch32v003 07:07:01 [INFO] WCH-Link v2.11 (WCH-LinkE-CH32V305) 07:07:01 [INFO] Erase chip by PowerOff 07:07:01 [ERROR] --chip not specified Error: Chip doesn't support power off erase
it seems though, --chip option is working, since when I use a different chip name, it produces another error:
wlink erase --method power-off --chip CH32V003J4M6 error: invalid value 'CH32V003J4M6' for '--chip <CHIP>': Unknown RISC-V Chip: 0x00

@thirstyone
Copy link
Author

thirstyone commented Nov 24, 2023

basically, the following code in main.c should produce some results, shouldn't it?

#define DEBUG_DATA0_ADDRESS  ((volatile uint32_t*)0xE00000F4)
#define DEBUG_DATA1_ADDRESS  ((volatile uint32_t*)0xE00000F8)

int main(void)
{
    NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
	    Delay_Init();
		Delay_Ms(4000);		
		USART_Printf_Init(115200);
		*(DEBUG_DATA0_ADDRESS) = 0;
		Delay_Ms(1000);
		*(DEBUG_DATA1_ADDRESS) = 0x55565758;
		*(DEBUG_DATA0_ADDRESS) = 0x07505151;
//		*(DEBUG_DATA0_ADDRESS) = 0x50505107; //tried this as well...
		
	while(1) {
		int i = 0;
			Delay_Ms(1000);
	}

but I get the same 'er computer software' message (sometimes different part of it, but anyway, not what I expect)

@thirstyone
Copy link
Author

I have no idea what was the culprit. Probably, some segfault because of misuse of printf library. But now it works as expected. Now people ask if it's possible to use the scan functionality with SDI ;-) You know, the more you have, the more you want.

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

No branches or pull requests

3 participants