Hello, is there a HAL I2S Driver? I’m having problems testing it:
./lib/chibios/os/hal/include/hal_i2s.h:84:10: fatal error: hal_i2s_lld.h: No such file or directory
[DEV] RP2040 support
- Giovanni
- Site Admin
- Posts: 14382
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1065 times
- Been thanked: 908 times
- Contact:
Re: [DEV] RP2040 support
Hi,
There is no I2S driver for RP2040 this is why you get that error.
Giovanni
There is no I2S driver for RP2040 this is why you get that error.
Giovanni
-
- Posts: 77
- Joined: Sat Mar 19, 2016 8:07 pm
- Been thanked: 17 times
Re: [DEV] RP2040 support
Be aware that the RP2040 doesn't have I2S support in hardware. To implement I2S the most common way is to use a PIO unit and program it to implement I2S the way you need it.
As far as I'm aware this would be the first subsystem in ChibiOS HAL that utilizes the PIO units. So I think you'd need some HAL LLD layer first that configures the PIO units. On top of that you could then add a I2S PIO implementation that implements the regular HAL LLD for I2S. Also the toolchain to compile PIO assembler would have to be integrated.
Also be aware that using the PIO for I2S will result in a less flexible solution regarding clocking than the I2S hardware for example in a modern STM32. Meaning the RP2040 system clock will always have to provide the I2S master clock and this will lead to more jitter than using a dedicated low-jitter clock.
As far as I'm aware this would be the first subsystem in ChibiOS HAL that utilizes the PIO units. So I think you'd need some HAL LLD layer first that configures the PIO units. On top of that you could then add a I2S PIO implementation that implements the regular HAL LLD for I2S. Also the toolchain to compile PIO assembler would have to be integrated.
Also be aware that using the PIO for I2S will result in a less flexible solution regarding clocking than the I2S hardware for example in a modern STM32. Meaning the RP2040 system clock will always have to provide the I2S master clock and this will lead to more jitter than using a dedicated low-jitter clock.
Re: [DEV] RP2040 support
Thx a lot for your pointers.
Actually, I’m using QMK firmware for keyboard (which runs on ChibiOS) and I try to play low fidelity sounds in small mono speakers, so a limited clocking solution should be enough.
I’ve been said that a number of PIO code is around, I will try to adapt one of them...
About...
...because QMK uses PIO for controlling RGB leds so (see https://docs.qmk.fm/#/ws2812_driver?id=pio) this must be non chibios code, right?
Actually, I’m using QMK firmware for keyboard (which runs on ChibiOS) and I try to play low fidelity sounds in small mono speakers, so a limited clocking solution should be enough.
I’ve been said that a number of PIO code is around, I will try to adapt one of them...
About...
...causes me a doubt... could I use a “non chibios driver” ??? I thought I was restricted to use/modify chibios code.this would be the first subsystem in ChibiOS HAL that utilizes the PIO units
...because QMK uses PIO for controlling RGB leds so (see https://docs.qmk.fm/#/ws2812_driver?id=pio) this must be non chibios code, right?
- Giovanni
- Site Admin
- Posts: 14382
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1065 times
- Been thanked: 908 times
- Contact:
Re: [DEV] RP2040 support
Hi,
Of course you can use non-ChibiOS driver alongside ChibiOS ones, there are no restrictions.
Giovanni
Of course you can use non-ChibiOS driver alongside ChibiOS ones, there are no restrictions.
Giovanni
-
- Posts: 77
- Joined: Sat Mar 19, 2016 8:07 pm
- Been thanked: 17 times
Re: [DEV] RP2040 support
pbrena wrote:About......causes me a doubt... could I use a “non chibios driver” ??? I thought I was restricted to use/modify chibios code.this would be the first subsystem in ChibiOS HAL that utilizes the PIO units
...because QMK uses PIO for controlling RGB leds so (see https://docs.qmk.fm/#/ws2812_driver?id=pio) this must be non chibios code, right?
My comment was regarding implementing this within ChibiOS HAL, in a way that would eventually allow it to be included in ChibiOS-Contrib(*). This would allow you to use the HAL I2S interface, making it easy to port this to another MCU.
You can of course always directly interface the hardware without using HAL. Porting this code to another MCU would be more work then, but a first implementation just for RP2040 is probably easier. I haven't investigated how the WS2812 driver in QMK you linked works.
*) Regarding ChibiOS-Contrib: be aware that I'm not member of the ChibiOS-Contrib team, don't have commit rights there and don't make any decisions regarding what is appropriate to commit there or not. So this is just my personal opinion.
Return to “Development and Feedback”
Who is online
Users browsing this forum: No registered users and 11 guests