-
Notifications
You must be signed in to change notification settings - Fork 25
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
V307: not running #6
Comments
Then the whole dev env setting doesn't work. You should remove "SDI Print" and any "print!()" in the demo code. |
Agreed. |
I use the WCH-LinkE from my CH32V003 dev board with the v307. The wlink properly warn about the missing SDI feature of the default probe :) I will continue to investigate. |
|
I have done some tests today and I have noticed that the config that works in the I have noticed that with my WCH-Link-CH549 probe, the code run even with |
I have received a new CH32V307VCT6 board (a YD-CH32V307VCT6 clone) and I am facing the same issue, no code run on it. |
@romainreignier Thanks for the report. I'm using YD-CH32V307VCT6 too. I need to dig out what's happened. |
|
It's a StoreFault error when accessing 0x2000ffdc. Could you help diagnose which instruction causes the error? Hint:
|
I can help but I don't understand what are you asking for exactly? I am not too confident in low level embedded stuff. |
I have tried:
That gave me:
Edit: this and the |
I'll run some stress tests on the blinky and the board to investigate further. |
From what I have seen, no code run when the FLASH size is set to 256k and RAM size to 64k. This code runs correctly: #![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
use hal::gpio::{Level, Output};
use {ch32_hal as hal, panic_halt as _};
use qingke::riscv;
#[qingke_rt::entry]
fn main() -> ! {
let p = hal::init(Default::default());
let mut led = Output::new(p.PA15, Level::Low, Default::default());
loop {
led.toggle();
riscv::asm::delay(1000000);
}
} But the embassy blinky (from the examples) blocks after having switched ON the LEDs.
I see that the cause is different: And
|
After a git bisect, it appears that the failing embassy examples on ch32v307 are caused by the change of the embassy_time feature from
|
By looking at systick I have seen that with the default hal init So either the embassy_time tick rate should be reduced or all the examples updated to use a PLL or Systick timer set in mode HCLK without the div 8. |
The blinky blocked after a while (
Does not seems to work. Edit: The time before the blocking is not stable 3, 4, 18 seconds, with |
I think that I have finally found an answer to my issue with the FLASH and RAM size in the linker script. $ wchisp config info
11:10:00 [INFO] Current config registers: a55aff0000ff00ffffffffff00020900a365be7b5450b531
RDPR_USER: 0x00FF5AA5
[7:0] RDPR 0xA5 (0b10100101)
`- Unprotected
[16:16] IWDG_SW 0x1 (0b1)
`- IWDG enabled by the software, and disabled by hardware
[17:17] STOP_RST 0x1 (0b1)
`- Disable
[18:18] STANDBY_RST 0x1 (0b1)
`- Disable, entering standby-mode without RST
[23:22] SRAM_CODE_MODE 0x3 (0b11)
`- CODE-228KB + RAM-32KB
DATA: 0xFF00FF00
[7:0] DATA0 0x0 (0b0)
[23:16] DATA1 0x0 (0b0)
WRP: 0xFFFFFFFF
`- Unprotected On my board, the config is Now I need to figure out how to change that setting and add some info in the CH32V307 example README about it. |
I have read the current value this code and it works: let flash = hal::pac::FLASH;
let sram_code_mode = flash.obr().read().sram_code_mode();
hal::println!("sram_code_mode = {:#b}", sram_code_mode); But I have failed to set a new value with this code: flash.obr().modify(|w| w.set_sram_code_mode(0b10)); I have a build error: error[E0599]: the method `modify` exists for struct `Reg<Obr, R>`, but its trait bounds were not satisfied
--> src/main.rs:25:17
|
25 | flash.obr().modify(|w| w.set_sram_code_mode(0b10));
| ^^^^^^ method cannot be called on `Reg<Obr, R>` due to unsatisfied trait bounds
|
::: /home/rre/.cargo/git/checkouts/ch32-metapac-06b85fb47469f0da/82e1fdc/src/common.rs:6:1
|
6 | pub struct R;
| ------------ doesn't satisfy `R: ch32_hal::ch32_metapac::common::Write`
|
= note: the following trait bounds were not satisfied:
`R: ch32_hal::ch32_metapac::common::Write` I am not used to use direct pac access, I must have overlooked something but I don't know what. |
@romainreignier FLASH_OBR is read-only according to datasheet. |
It requires unlocking and programming sequence using FLASH_CTLR. |
Ok, thanks, I will have to write the flash sequence then. |
The SEVONPEND trick in #36 seems to have fixed the hanging issue for me, I have a board blinking 3 days now :) About the memory split issue, I have not tried more to change it in a Rust program yet but cnlohr has released a C program to do it and a PR implements it in minichlink. It might be an idea to do it in wlink! I have not tried these solutions yet. Once validated, I will try to add some info in ch32-hal readme to avoid the trouble for others and close this issue. |
Close as fixed. Thank you all. |
I have tried several examples of the CH32V307 on a "CH32V307 EVT by SCDZ" board:
But the programs are not running (not blinks with blinky.rs and no output with
sdi_print.rs
).I have tried to change the HSI/HSE settings while initializing the hal but nothing changed.
I the V307 supposed to work already? Or maybe a regression introduced with recent changes?
I have pulled the ch32-metapac from the prebuilt repo.
I have tried the blink.c example from ch32v003fun and it works.
It might be interesting to enable the "Discussions" on this repo to avoid opening issues for these kind of newbie questions.
Thanks
The text was updated successfully, but these errors were encountered: