-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
Work on STM32 SPI implementation #677
Conversation
Hi @josesimoes, I'm nanoFramework bot. A human will be reviewing it shortly. 😉 |
81c4ab9
to
59f430b
Compare
- Add CLR events to STM32 SPI native code to allow for smooth Tx/Rx of large buffers - Add sanity check for buffer overflow - Add SPI master CLR event - Add code to assert/deassert chip select line (ChibiOS driver doesn't implement that) - Add SPI configuration for all SPI enabled targets - Fix calls to cache helpers Signed-off-by: josesimoes <[email protected]>
59f430b
to
20e6f05
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a stable spin on the SPI Display on the 429 board for running more than a day, this looks good, but the performance must be approved. Instead of 15 secs the test program runs now for 26 secs.
You still merge with a nearly 50% performance penalty ? |
I do because (in no particular order):
Having said all that, any of these changes isn't simple, plain, black and white. nanoFramework it's a rather complex system and everything that one changes has the potential to cause ramifications that sometimes are not that obvious. Like with any other system of this nature it's not perfect and one can't always have the "best of both worlds". Anyways this is software and it's not written with fire on stone, so it can be changed at any time. 😺 |
I think that you are right on the analysis but wrong on the solution. Indeed, it can be a problem if/when the managed app is freezing during large transfers. But... Except for very specific uses, like graphic drivers, the size of the transmitted data is not that big. I have no real idea of which size could be given, but let's say that 100 bytes is more or less a good value. With your latest changes, everybody will have that 50% penalty (rouglhy rounded up, I admit), regardless of the size of the transmitted data. When they would not have noticed anything before, now they will see that penalty on the long run. Granted, noone will see 50% less performance, but the slow-down will still be noticeable. Edit: what I want to say here is that 100% of the people will have the performance penalty where only a few % would have had it before (those sending large buffers only). You are right about the managed graphic driver performances, no doubt about this. But this example is perfectly showing the difference in performance that will impact everyone now with these changes. I personnally would have prefered either the choice sync/async or some kind of "education", teaching that sending large buffer can be counter-productive and that the managed program should try to handle large buffers in chuncks. |
Anyway, that's useless discussion since the PR is closed and only people subscribed to this channel will see it. |
Also, could you elaborate on this, please ?
|
I agree with your assessment on the use cases and the performance impact of adding the CLR events to properly deal with large buffers. In this particular case it's quite easy to tackle this without exposing extra configuration options and having to produce massive documentation. It's a simple matter of evaluating if the requested SPI transaction will take longer than a thread execution slot. If it is: setup a CLR event for continuation (the DMA will nicelly handle it in the background) if it's not then perform it in a single stroke without any further ceremony. On your question above: not having the CLR events to deal with large buffers the implementation would be freezing the execution thus not being entirely functional on those situations. |
Description
Motivation and Context
How Has This Been Tested?
Screenshots
Types of changes
Checklist:
Signed-off-by: josesimoes [email protected]