-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
spi on other pin #3
Comments
Hello. I also have a custom board based on the samd21e18a and would like to change the sercom device used by the Wire library. I think this is essentially the same problem that @bobricius has. (but Wire instead of SPI) @cmaglie I would be happy to code a fix and submit a pull request, but wanted to check first to see if you have already started or if you have thoughts on how it should be done? It looks like variant.cpp can define the serial objects (sercom0, sercom1, etc.) but can't change which handler is used by which library. One simple idea I had is to allow variant.h to #define the sercom and handler names. So, ie, variant.h: #define WIRE_SERCOM sercom0 and in the wire library (with something similar in the other SERCOM based libraries) : #ifndef WIRE_SERCOM #ifndef WIRE_SERCOM_HANDLER TwoWire Wire(&WIRE_SERCOM); void WIRE_SERCOM_HANDLER(void) { Please let me know if that sounds like an acceptable solution or if you have other ideas about how you'd like it to be done. Thanks a lot! |
Hi @pixelpixi, @bobricius, why not creating your own variant? |
Hi @aethaniel. I have my own variant ( https://github.com/modulolabs/arduino-hardware/tree/master/samd ) but unfortunately the variant can't override which SERCOM is associated with which library. That's because the libraries themselves are hard coded to specific SERCOM numbers. ie, in Wire.cpp: TwoWire Wire(&sercom3); void SERCOM3_Handler(void) { So I think the only way of doing it is to fork the entire core, which obviously I'd rather not do. |
Hi Erin, Indeed, these definitions shall be present in variant files and not in core API. I will do some tests tomorrow and if OK transfer these lines to their right place. Cheers, T. On 1 August 2015 00:26:41 CEST, Erin Tomson notifications@github.com wrote:
Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté. |
Hi @pixelpixi, @bobricius, @cmaglie, Sorry to be late on this, it haven't been able to test before today. My tests were to move definitions and instantiations into variant.[h|cpp] but link failed because of lack of class/function/symbols as SPI and Wire were not part of my test sketch. In the current state, platform.txt and board.txt disallow me to add these files into the build but maybe @cmaglie would have a precise idea on how to force add some files. My own personal opinion would be to move, for ARM devices, SPI and Wire files to core API folder but this could cause waves. After discussing with a friend on the problem, some ideas emerged but all of them lead to some modifications in IDE behaviour:
Anyway, this must be solved to allow new variants to emerge without constraints, considering all muxing possibilities of SAMD21. |
@pixelpixi, by the way, you shouldn't have to duplicate the whole core into your variant to obtain fast working result: did you try only to duplicate libraries/SPI, modified to match your SERCOM? |
Hi @aethaniel. Thanks for your work on this. I didn't try duplicating just the library I need. I didn't realize that is supported. Neat! I'll give it a shot. Too bad that moving the definitions to variant.cpp didn't work. That would have been an elegant solution. How about my original suggestion of using macros in variant.h to define which SERCOM object each library uses? I think that would avoid the library dependency/inclusion problems you were having. I can code it up further and submit a pull request if you like. Let me know. Thanks, |
Hi @pixelpixi, If you can give a try about duplicating the library, it could be nice indeed. Warning: it is only an hypothesis. I'm clearly not sure if it would work. By the way, after years it seems I'm still trying to provide a solution following the most complex path: your proposal is much more efficient in term of rework cost. My previous work was here: https://github.com/aethaniel/ArduinoCore-samd/tree/wire_spi_instances_in_variant |
Hi @pixelpixi, at first glance it should be OK for SPI to have the definitions into variant. Investigation in progress, will come back to you later today, normally. |
Hi @pixelpixi @bobricius @cmaglie, I have something compiling nicely with Arduino IDE and bringing the customization you both need on either Wire or SPI: 3 commits are present: one for variant file update, one for SPI and one for Wire: Could you please update your local files and tell me if theses updates fit your needs or if I missed something? If OK, I will submit the PR to Cristian. Thanks |
Hi @aethaniel. I tested this for the Wire library and it works great for me! Thanks for coding the fix and let me know if there's anything else I can do. |
Fixed by #24. |
Configure CI workflow to compile AceTime library example
I have custom boad with atsamd21e18 with micro sd card connected to
miso a19
mosi a16
sck a17
ss a18
I want try zero audio but I can change only ss pin, but I have no idea when I can use another spi pins. I think that all pins I used are another spi connected to edbg chip. thanks
The text was updated successfully, but these errors were encountered: