-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
SAMD51 SPI Secondary Mode #9385
base: main
Are you sure you want to change the base?
Conversation
…in and parameter passing has issues
…o adafruit-9.0.x Rebasing onto 9.0.3 (plus 4 commits) from 9.0.0-alpha, to get updates that fix asyncio library
…erted Metro M4 Express board configurations to original
…ld scripts to build firmware for rapid0 boards, updated peripherals submodule
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.
Thanks for the PR! A couple organization suggestions that will slim down this PR.
Adafruit has been using "main" and "secondary" for the "M" and "S" names. I have also seen "sub" or "subnode". There was a proposal for "peripheral" and "controller", with "PICO" and "CIPO" pin names, but that has not been widely adopted. We aren't planning to rename "MOSI" and "MISO", so "main" and "secondary" are probably fine. |
Hi, just wanted to follow up to see if there's changes to be requested on this feature. I added some commits a few months back to address the concerns you've expressed so far. I know you guys are busy, let me know how I can help or if there's something I missed! |
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.
Thanks for the ping! Sorry for not getting back to you. I was on leave last fall (and will be later this year again.)
Please ensure the CI tests are passing too. That way we can merge if it is ready.
//| """Queue data for the next SPI transfer from the main device. | ||
//| If a packet has already been queued for this SPI bus but has not yet been transferred, an error will be raised. | ||
//| | ||
//| :param bytearray miso_packet: Packet data to be sent from secondary to main on next request.""" |
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.
Please document mosi_packet
too. Is the expectation that this memory isn't mutated after the function call?
} | ||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(spitarget_spi_target_load_packet_obj, 1, spitarget_spi_target_load_packet); | ||
|
||
//| def try_transfer(self, *, timeout: float = -1) -> bool: |
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.
//| def try_transfer(self, *, timeout: float = -1) -> bool: | |
//| def wait_transfer(self, *, timeout: float = -1) -> bool: |
I think I'd call this wait since it doesn't initiate the transfer.
#include "py/runtime.h" | ||
|
||
//| class SPITarget: | ||
//| """Serial Peripheral Interface protocol target""" |
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.
Please include a basic example here so that we can see what the API use looks like.
uint8_t MISO_pin; | ||
uint8_t SS_pin; | ||
|
||
dma_descr_t running_dma; |
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.
I think you'll want to store the buffer objects here while a transfer is in progress. If you don't the garbage collector may clean them up while a transfer is in progress.
Addresses #2131. Tested on a pair of custom breakout boards which were derived from the Metro M4 Express.