-
Notifications
You must be signed in to change notification settings - Fork 36
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
TEST: SPI: CS is isually a DigitalOut #21
Conversation
In most SPI libs, CS is controlled as a GPIO, so as a DigitalOut. This is also how this is done in the next SPI tests. So when testing the instance creation, better to use this type as well.
It should work out of the box - defining SSEL in the SPI ctor. why it fails for ST? Is it because SSEL pins are not defined properly in pinmap structure? it should work as well as you changed it but I believe we want to test SPI class that means we might want to have both use cases, having CS outside of SPI class and part of it. |
The SSEL pin of SPI IP in the STM32 of at least NUCLEO_L476RG and NUCLEO_F410RB are physically not muxed / connected to PB_6, which is the pin wired as D10 on those boards. Considering this is a preliminary test to access SDFileSystem which uses cs as a DigitalOut, I think this makes sense. If we want to test the object creation with HW CS rather than DigitalOutput on those boards, we would need to define 2 different PINs. The one for using SD card |
I agree. Maybe use the naming: |
The
Most of the test cases in spi use SDFileSystem that is using sw chip select thus it works. @BlackstoneEngineering what do you think? |
@0xc0170 so the usage in driver would differs depending of hw or sw SSEL. In case of DIO, the SPI device driver specifically sets the cs. In case of HW there is no mention of cs in the driver as it is autonomously done in HW. All in all I think it best to let the SPI user specifically decides between sw and hw so that the driver's code correspondingly manages (or not) cs For this concrete test, this is a SD SPI test case and only sw CS is being used, so I think it makes sense to have the object creation with sw cs. We could have another test case, with HW object creation, but this would also be best to have a driver that makes use of this configured SPI with hw cs. |
Agree. If this gets integrated, there should be an issue created to reflect this: |
@BlackstoneEngineering Please review and integrate |
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.
+1
In most SPI libs, CS is controlled as a GPIO, so as a DigitalOut. This
is also how this is done in the next SPI tests. So when testing the
instance creation, better to use this type as well.
If this is not done, tests would fail on boards where Hardware CS (NSS in pin STM32) is not muxed onto D10. This would require to define all the particular mapping of those boards, whereas using D10 as a DigitalOut is valid for any MBED board.