Closed tomcombriat closed 1 year ago
Ok found it. Unfortunately I will have not have time to work on that for the remaining on the week…
(Just to precise, as I never enough time to go very far, I commit things I am doing on this on the go, even thought a big step might not be finished, I think we will probably need to squash some of these commits in the end!).
Compiles now, but nothing implemented.
Memory usage change @ e4c162ba796ca5dc092adf9b41f3154789515055
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:uno |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_giga:giga |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:adafruit_circuitplayground_m0 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
esp8266:esp8266:huzzah |
N/A | N/A | N/A | N/A |
rp2040:rp2040:rpipico |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
Memory usage change @ d1007efd8b3bca81e5addf88f0628780d0288efc
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:uno |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_giga:giga |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:adafruit_circuitplayground_m0 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
esp8266:esp8266:huzzah |
N/A | N/A | N/A | N/A |
rp2040:rp2040:rpipico |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
Memory usage change @ 809d83ad57700b01a64ca07a63e238bca4f894b3
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:uno |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_giga:giga |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:adafruit_circuitplayground_m0 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
esp8266:esp8266:huzzah |
N/A | N/A | N/A | N/A |
rp2040:rp2040:rpipico |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
Memory usage change @ ec613ec04070b45c5a0b4999b77c3931df3ea745
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:uno |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_giga:giga |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:adafruit_circuitplayground_m0 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
esp8266:esp8266:huzzah |
N/A | N/A | N/A | N/A |
rp2040:rp2040:rpipico |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
Memory usage change @ 3369379795bfe4fc280652690b10d02fc828f57a
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:uno |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_giga:giga |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:adafruit_circuitplayground_m0 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
esp8266:esp8266:huzzah |
N/A | N/A | N/A | N/A |
rp2040:rp2040:rpipico |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
Memory usage change @ 862f2a03cd51bd5a3357cc69211d76ff15af57b9
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:uno |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_giga:giga |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:adafruit_circuitplayground_m0 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
esp8266:esp8266:huzzah |
N/A | N/A | N/A | N/A |
rp2040:rp2040:rpipico |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
Memory usage change @ bf03810d2cce9028515ba6454c97d76875fd8e56
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:uno |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_giga:giga |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:adafruit_circuitplayground_m0 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
esp8266:esp8266:huzzah |
N/A | N/A | N/A | N/A |
rp2040:rp2040:rpipico |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
Alright, things got a bit harder than expected, but at least a first version is working! I am converting this PR to "ready" even though it should not be merged yet, more to indicate that I think that is now room for eventual discussion. Furthermore a bit of cleanup, squashing and documentation will likely be welcome.
There is a single DAC pin (A0) on this board, the configuration is using that by default.
As said this DAC can work straight from a buffer (no need to commit the buffer for instance), and I chose to use a Mozzi circular buffer for that that is actuated along the way and the DAC just reads from that. Unfortunately, I had to add a access to the data that the buffer contains, I think it is not very problematic but there might be some debates here.
The DAC sample frequency can be set by a timer (you can have a look at the code, it is not completely straightforward) which is quite neat but unfortunately I did not find any way to know how many samples has been played. Hence, as the DAC is not popping the samples from the buffer per se, one needs to tell the buffer that some samples can be removed in order to make room for the next ones…
And I had to use another timer for that… I could not find a way to use the same timer for both updating the DAC and calling and IRQ to remove the samples from the buffer (setting up the IRQ stops the DAC or vice-versa). There might be a trick somewhere but I could not find it.
analogRead
s are not implemented (even thought, from what I have seen it should not be too hard (1))(1): I should be more careful when saying that, it always ends up being a lot more work than expected ;).
Memory usage change @ 1d26c29f5a0383d1a2f8ffb17c472fdce69c7cb1
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:uno |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_giga:giga |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:adafruit_circuitplayground_m0 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
esp8266:esp8266:huzzah |
N/A | N/A | N/A | N/A |
rp2040:rp2040:rpipico |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
Hello!
This is now tested (and working) with the Uno R4 WiFi!
I would be in favor of merging that, even though the mozziAnalogRead()
is not implemented yet and maybe rolling out a version when this is implemented but as I made a few changes deep in Mozzi I would prefer to have a second opinion!
Memory usage change @ 76cbfb0fce09213d9100668be65b45749f8f3ac9
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:uno |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_giga:giga |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:adafruit_circuitplayground_m0 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
esp8266:esp8266:huzzah |
N/A | N/A | N/A | N/A |
rp2040:rp2040:rpipico |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
Memory usage change @ 468ef4efd90c1d6710f70b18ebe9ef71c8d4f82a
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:uno |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_giga:giga |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:adafruit_circuitplayground_m0 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
esp8266:esp8266:huzzah |
N/A | N/A | N/A | N/A |
rp2040:rp2040:rpipico |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
Memory usage change @ 50664ab8b14c123204a90c9fcc9d993d32cfcbe7
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:uno |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_giga:giga |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:adafruit_circuitplayground_m0 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
esp8266:esp8266:huzzah |
N/A | N/A | N/A | N/A |
rp2040:rp2040:rpipico |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
Alright, I took into account most of your comments @tfry-git . Let me know what you think.
You will see that I left out trying to get everything on one timer: I remember banging my head on it before but I cannot afford to spend the night on it today ;). I honestly think that this go in like that for now, as it is working but with acknowledging that:
Cheers,
Memory usage change @ eeaeef68d0509b8e27460b62abd241ddee5c2c36
Board | flash | % | RAM for global variables | % |
---|---|---|---|---|
STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:avr:uno |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:mbed_giga:giga |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
arduino:samd:adafruit_circuitplayground_m0 |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
esp8266:esp8266:huzzah |
N/A | N/A | N/A | N/A |
rp2040:rp2040:rpipico |
0 - 0 | 0.0 - 0.0 | 0 - 0 | 0.0 - 0.0 |
@tfry-git Ok thanks, will merge that then! Next target will be async ADC for this platform probably.
I have to say I did not fully understand your last paragraph. Do you mean to make manually a circular buffer working on the "native" samples for the Renesas? Or the native ones of Mozzi? The way I saw this is, if a platform of this arch with two DACs should arise, then the modification to this code should be minimal (adding a other buffer and branching it, it can be advanced by the same timer than the first one).
On the wider way of thinking, apart from making the buffers customizable in size, maybe we should start to think in terms of a pool of buffers? For instance creating a pool of one or two buffers for mono and stereo and working on that (instead of reading them separately) which would potentially remove a good chunk of preproc for the stereo case? Of course that might also make the way easier for more channels… These are just thoughts, not sure how good it would turn in practice though.
Hi!
This is a draft PR, just to have a discussion space for the port of the Arduino R4.
My initial attempt did not go very far, I cannot find the good variable for discriminating the board in the
hardware_defines.h
.I am not completely sure, but I think there is a
{includes}
missing in the platform.txt file for this board. I would have expected something like-DARDUINO_FSP {build.library_discovery_phase_flag}
in there. As it is not there this precomp variable is not set in the included library (and Mozzi for that extend).I am just wondering if I am on a completely wrong path here… If that sound legit, I'll ask Arduino about it.