!zbjndUiYJDvhDRkPGw:matrix.org

rp-rs

477 Members
Rust on the Raspberry Pi Microcontrollers/Pico https://github.com/rp-rs 54 Servers

Load older messages


SenderMessageTime
29 Nov 2023
@ithinuel:matrix.orgithinuel

On core 1, that bootrom will "park" it waiting to be awaken.

On core 0, that bootrom I'll load 256bytes from the external spi flash and run whatever is loaded.

Those 256bytes should configure the spiflash interface and the xip block so that it matches the best performances of that flash device.

17:07:20
@ithinuel:matrix.orgithinuel Then it should jump into your application. 17:07:44
@lc1408:matrix.orgJarrod HamiltonSorry I'm really new to this. So when I run probe-rs run --chip RP2040 do I need to add more? Do I need to add something to the config.toml file?17:12:53
@ithinuel:matrix.orgithinuel No. 17:13:15
@ithinuel:matrix.orgithinuel But your application should build &link with the "boot2" part set at the start of your binary. 17:13:51
@ithinuel:matrix.orgithinuel

Do you have your code available online for us to review it?

Did you use one of our many examples or seeded your project with the template we provide ?

17:14:48
@lc1408:matrix.orgJarrod HamiltonHere is a link to my question on GitHub with I think the important parts of my code. https://github.com/knurling-rs/probe-run/issues/429#issuecomment-1831514362 Here is the template I used. https://github.com/knurling-rs/app-template I didn't know you guys had a template before now. I can try that one! 😁17:26:28
@ithinuel:matrix.orgithinuel https://github.com/rp-rs/rp2040-project-template 17:28:30
@ithinuel:matrix.orgithinuel Note we recommend probe-rs since probe-run is no longer being developed. 17:29:23
@ithinuel:matrix.orgithinuel* Note we recommend probe-rs (what probe-run is based on) since probe-run is no longer being developed.17:29:57
@ithinuel:matrix.orgithinuel You can install it with `cargo install probe-rs --feature cli` 17:30:35
@lc1408:matrix.orgJarrod HamiltonOkay! I'll try probe-rs and your template. Thank you!17:33:15
@dieseldev:matrix.orgdieseldev joined the room.18:20:07
@dieseldev:matrix.orgdieseldev

Hello, I am trying to control my servo motor with PWM On the raspberry pi pico, but cannot seem to get anywhere with the right pwm values, here is the documentation from my servo:
https://docs.rs-online.com/0e85/0900766b8123f8d7.pdf

and I have some code snippets, it is just modified example code, The problem I have is no matter what duty cycle values I pass in, I cannot get the full range of motion or set angles properly
let pwm = &mut pwm_slices.pwm0;
pwm.set_ph_correct();
pwm.set_div_int(20u8); // 50 hz
pwm.enable();

// Output channel B on PWM0 to the GPIO1 pin
let channel = &mut pwm.channel_b;
channel.output_to(pins.gpio1);

// Infinite loop, moving micro servo from one position to another.
// You may need to adjust the pulse width since several servos from
// different manufacturers respond differently.
loop {
    // move to 0°
    channel.set_duty(750);
    count_down.start(400.millis());
    let _ = nb::block!(count_down.wait());

    // 0° to 90°
    channel.set_duty(1500);
    count_down.start(400.millis());
    let _ = nb::block!(count_down.wait());

    channel.set_duty(2250);
    count_down.start(800.millis());
    let _ = nb::block!(count_down.wait());
}
18:21:55
@quantum_ef:matrix.orgquantum_ef
In reply to @dieseldev:matrix.org

Hello, I am trying to control my servo motor with PWM On the raspberry pi pico, but cannot seem to get anywhere with the right pwm values, here is the documentation from my servo:
https://docs.rs-online.com/0e85/0900766b8123f8d7.pdf

and I have some code snippets, it is just modified example code, The problem I have is no matter what duty cycle values I pass in, I cannot get the full range of motion or set angles properly
let pwm = &mut pwm_slices.pwm0;
pwm.set_ph_correct();
pwm.set_div_int(20u8); // 50 hz
pwm.enable();

// Output channel B on PWM0 to the GPIO1 pin
let channel = &mut pwm.channel_b;
channel.output_to(pins.gpio1);

// Infinite loop, moving micro servo from one position to another.
// You may need to adjust the pulse width since several servos from
// different manufacturers respond differently.
loop {
    // move to 0°
    channel.set_duty(750);
    count_down.start(400.millis());
    let _ = nb::block!(count_down.wait());

    // 0° to 90°
    channel.set_duty(1500);
    count_down.start(400.millis());
    let _ = nb::block!(count_down.wait());

    channel.set_duty(2250);
    count_down.start(800.millis());
    let _ = nb::block!(count_down.wait());
}

I think the clock divider may need to be set to 2 or 3 instead of 20.

my thought process is that given a system clock of 12MHz/ 63535 counts of the pwm counter or whatever / 3 = ~61 Hz

19:48:35
@dieseldev:matrix.orgdieseldevoh ok, I thought it was one second, Thank you19:49:06
@ithinuel:matrix.orgithinuelI made this: https://crates.io/crates/i2c-write-iter20:39:42
30 Nov 2023
@slushee:arcticfoxes.netSlushee changed their profile picture.00:22:05
@jannic:matrix.orgjannic dieseldev: I think the initial value of 20 was about right, if you are using the default system clock, because that is 125MHz, not 12MHz.
The useful range for set_duty should be between 1200 and 3500 for that servo, if I got the manual correctly.
07:07:53
@mrvlt:matrix.orgMister VoLT joined the room.11:44:08
@waveguide:matrix.orgspinfast changed their profile picture.17:33:16
@victor1235:matrix.org@victor1235:matrix.org joined the room.23:02:14
@victor1235:matrix.org@victor1235:matrix.org left the room.23:08:01
1 Dec 2023
@mbrossard:matrix.orgMathiasLate to the party... From an arch-specific point of view, the answer is probably FVP: https://developer.arm.com/Tools%20and%20Software/Fixed%20Virtual%20Platforms For A and R profiles, the Architecture FVPs are most likely the ones you want to use. For Cortex-M, the closest thing is Corstone-300 in the Ecosystem FVPs (https://developer.arm.com/downloads/-/arm-ecosystem-fvps).01:36:28
@mbrossard:matrix.orgMathiasCorstone-300 is a Cortex-M55. There are others FVPs (also called fast-models) for other Cortex-M cores but they requires commercial versions of Keil MDK or Arm Developer Studio. In my experience those are very complete and accurate models of cores (the rest of the "system" depends on the FVP), with a lot of options so they can be a little bit intimidating to get started. Note: they use a custom debug interface, but there is a (Rust-based) connector for gdb, https://github.com/Linaro/lite-cornea01:55:11
@ithinuel:matrix.orgithinuel

Ah that right, I understood the question as a test binary running on the core, not as binary modelling the core :D

Thanks Mathias @mbrossard:matrix.org 

07:44:57
@9names:matrix.org9namesthat is how i intended the question, i still appreciate the response07:50:52
@9names:matrix.org9names * the way you interpreted the question was what I meant (verifying that the system was honoring EABI, all variables initialised correctly) but I appreciate the hardware platform validation responses as well 07:52:50
@9names:matrix.org9names * the way you interpreted the question was what I meant (verifying that the software system was honoring EABI, all variables initialised correctly) but I appreciate the hardware platform validation responses as well 07:53:06
@ithinuel:matrix.orgithinuel *

Ah that's right, I understood the question as a test binary running on the core, not as binary modelling the core :D

Thanks Mathias @mbrossard:matrix.org

09:06:17

There are no newer messages yet.


Back to Room ListRoom Version: 6