It seems like you have a problem building the stm32h7xx-hal crate and not the libdaisy-rust crate. What version of Rust are you using? Maybe you need to bump it up.
On another note, I don’t build with the nightly toolchain. Also, maybe try building another example, i.e. passthru. I know, that one worked for me.
This definitely doesn’t have anything to do with your revision of the board!
If I don’t use nightly, there will be even more errors. I guess for embedded Rust to use nightly is quite common.
Now I disable the sdmmc feature and it compiles fine. But what would be the expected behaviour of the passthru example? I only have a headphone with me. It may be nice to have a testing sine tone.
I guess, delay, passthru and volume are the only examples with audio output. However, they depend on audio input. So you would need to have an audio source for that (like a phone or laptop).
The audio callback should look something like this:
// Interrupt handler for audio
#[task(binds = DMA1_STR1, local = [audio, buffer, oscillator], priority = 8)]
fn audio_handler(mut ctx: audio_handler::Context) {
let audio = &mut ctx.local.audio;
let buffer = &mut ctx.local.buffer;
let oscillator = &mut ctx.local.oscillator;
// this needs to be called
audio.get_stereo(buffer);
for _ in buffer {
let s = oscillator.next();
audio.push((s,s)).unwrap();
}
}
audio.get_stereo(buffer) is mandatory. I never got it working, if I didn’t call this function.
And buffer should be initialized in the #[init] task like this:
let buffer = [(0.0, 0.0); audio::BLOCK_SIZE_MAX]; // audio ring buffer
I tried to simplify the code but it is still not working:
#[task(binds = DMA1_STR1, shared = [], local = [audio, buffer, phase], priority = 8)]
fn audio_handler(mut ctx: audio_handler::Context) {
let audio = &mut ctx.local.audio;
let buffer = &mut ctx.local.buffer;
let phase = &mut ctx.local.phase;
audio.get_stereo(buffer);
for i in 0..buffer.len() {
match i {
0 => {
phase[i].0 = phase[phase.len()-1].0 + 440.0 / 48000.0;
phase[i].1 = phase[phase.len()-1].1 + 440.0 / 48000.0;
},
_ => {
phase[i].0 = phase[i-1].0 + 440.0 / 48000.0;
phase[i].1 = phase[i-1].1 + 440.0 / 48000.0;
}
}
let l = libm::sin((phase[i].0 * 2.0 * core::f32::consts::PI).into()) as f32;
let r = libm::sin((phase[i].1 * 2.0 * core::f32::consts::PI).into()) as f32;
audio.push_stereo((l, r)).unwrap();
};
}
Here I have init phase exactly same as buffer, a stereo f32 tuple.
When I flash it, it seems that there is a very short time of beeping.
I am sure my HW connection is correct as I can play the DSP example from the browser programmer.
/// Push data to the DMA buffer for output
/// Call this once per sample per call to [get_stereo()](Audio#get_stereo)
pub fn push_stereo(&mut self, data: (f32, f32)) -> Result<(), ()> {
self.phase += 440.0 / 48000.0;
let v = libm::sin((self.phase * 2.0 * core::f32::consts::PI).into()) as f32;
if self.phase >= 1.0 {
self.phase -= 1.0;
}
self.output.push((v, v))
}
This should in theory overwrite the audio with a sin tone for the examples passthru or volume, but I just got a very short and low-volume beep, the same as the result from the code above. Since I don’t have a ST-LINK yet, what would be the cause in your opinion? Anyway, I would assume it’s good to add some sound synthesis in the example given the usage of Daisy Seed.
The Daisy Seed has a mini JTAG Header pins (2x5). Is that what you’re looking for your pico-probe? I haven’t used that type of probe before so I cannot concretely tell you that it would work with the Daisy.