-
Notifications
You must be signed in to change notification settings - Fork 212
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
[sw] add ISR based SPI data flow example #373
Conversation
-> neorv32_spi_isr -> neorv32_spi_rw -> neorv32_spi_rw_busy
-> neorv32_spi_isr -> neorv32_spi_rw -> neorv32_spi_rw_busy
…into append_spi_driver
Now i'm a little confused. I tryed this with the builded gcc and there compiled the code fine.
|
@stnolting: Can this caused by the typedef struct t_neorv32_spi? Otherwise i can also pass a void pointer. |
Great work! I will come back to this later... 👍
This is a problem that only occurs in the C++ example program. In C++ |
Hello Stephan
Thanks for the hint. Now the question what do you prefer more, void pointer or pointer with an type? From the perspective of compile checks are pointer with an type better. Nevertheless now it should compile, please let me check the changes with my setup. I drop a message when i performed this tests. BR, |
I am also using the SPI interrupt in one application to move all transfers "to the background" - but my approach is rather "unpretty"... Your approach looks much cleaner and straightforward! However, I do not know how to handle this... I think your code might be very helpful for others trying to implement interrupt-driven SPI transfers. However, the core libraries are intended to be a minimal HAL only. Furthermore, if we add core library prototypes for interrupt-driven SPI transfers we should also add those for other modules like TWI, SLINK, UART, ... I think the best way to handle this is to create a new example project in What do you think about this?
I am no expert here, but I think the typed version seems to be a "safer" variant. |
Hi Stephan,
As first step let me to roll back to the typed version.
yes that we can do I would prefer to place this three functions closer to the core libs, that this is easily seen. Perhaps two files |
I understand that absolutely 😅 But when we have Furthermore, your interrupt-driven SPI functions are tailored to the NEORV32 runtime environment. If you have a setup running an RTOS like FreeRTOS you cannot use the NEORV32 RTE at all but you can still use the HAL from the core libs folder. Having an interrupt call back functions there might be misleading in that scenario. |
Mhh valid points :) Ok then do it in your way BR, |
Contributors wellcome :D :D :D Just do it :) |
Sounds good! Don't get me wrong, I really like having out-of-the-box support for IRQ-driven transfers! I just think that if we add something to the core libs it should be uniform across all peripherals... Anyways, mabye we should also add a link to the SPI's data sheet section referring the new IRQ-based example.
I'd be happy! So feel challenged! 😉😅 |
No Worry. All fine ;) I prepare some commits. I think it would take a while. |
-> provides functions for IRQ driven SPI data transfer as an minimal working example
Please wait before merge, i need to check. |
Sure. Just click "Ready for Review" when you're done. |
Done. |
Thanks for contributing! |
Hello Stephan,
i added an ISR data based dataflow to the neorv32_spi.c. Concrete i added three functions:
The function neorv32_spi_rw accepts an arbitrary number of bytes and the ISR gets the data from this internal buffer and forwards it to the SPI.
Following minimal example how to use:
For my project would it be a great help to bang not every single byte out, but send more bytes in one job. What do you think, is there a place for this code inside the NEORV32 sw libs?
Thanks for your help!
BR,
Andreas