Skip to content

Conversation

ardnew
Copy link
Contributor

@ardnew ardnew commented Sep 13, 2020

This adds support for the three SPI peripherals on the target feather-stm32f405.

This included extending the STM32 family's SPI implementation to now support the following options:

- Direction (full/half duplex)
- Hardware or software chip/slave-select
- 8-bit or 16-bit data frame format

@deadprogram
Copy link
Member

Also, @ardnew please note merge conflict that will need resolution via rebase against dev branch. Thanks.

@ardnew ardnew force-pushed the feature/feather-stm32f405-spi branch from b6be329 to e6d7ba8 Compare September 14, 2020 15:11
@deadprogram
Copy link
Member

Seems like the requested changes have all been made to the PR, is that correct?

Copy link
Member

@aykevl aykevl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks clean, however I'm wondering about this:

  • The SPI peripheral is enabled at the end of the Configure call
  • The SPI peripheral is enabled at the start of Transfer, if it isn't enabled already
  • The SPI peripheral is disabled at the end of Transfer.

Is it intentional to disable the SPI peripheral between transferring each byte? Why do you enable it then in Configure?

@ardnew
Copy link
Contributor Author

ardnew commented Sep 22, 2020

Is it intentional to disable the SPI peripheral between transferring each byte?

It was intentional on my part, yes, as this is what the STM32 HAL/LL drivers do before and after each transfer - I'm not sure why exactly they do it though. Clears pending flags? Paranoid attempt to minimize bus traffic? Helps prevent the user from re-configuring the interface while its enabled?

Why do you enable it then in Configure?

Good catch, indeed one of these is unnecessary. I think enabling/disabling for each transfer is the safer option, if not the most efficient. But I also think its a little pedantic and would be fine leaving it enabled between transfers unless someone objects.

@deadprogram
Copy link
Member

I do not think that you want to enable/disable on event call to Tx(), only on Configure(). It might "work" but will slow down operation considerably.

@deadprogram
Copy link
Member

Hi @ardnew any update on removing the register enable from the Tx() method? Thank you.

@ardnew
Copy link
Contributor Author

ardnew commented Oct 2, 2020

@deadprogram Sorry -- got a little distracted with other efforts!

Requested change implemented.

@deadprogram
Copy link
Member

Thanks @ardnew now squash/merging.

@deadprogram deadprogram merged commit 9ad2315 into tinygo-org:dev Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants