Hi,
According to the datasheet (and looking at the driver) we have four options for CS on the SPI interface (SPI_CS_CONFIG_REG) ... off, using SPI_CS0, using SPI_CS1, and FUNC_GPIO.
What is the last one? I can't find any documentation covering it anywhere (in fact that doesn't appear again anywhere in the datasheet, only in a few places in the SDK.)
My assumption is that this will use any GPIO pin you like as CS, but presumably you need to control it yourself as needed and not rely on SPI module or driver to do it???
So my project will have three slaves on the SPI bus (not including the module flash which is unrelated, unconfigured, and powered down) ... I can configure two of them using SPI_CS0 and SPI_CS1, but the third I'm assuming I'll need to use FUNC_GPIO and toggle the pin manually? (In which case, why wouldn't I just toggle them all myself to simplify the code? -- is there a performance implication?)
I also assume I switch between slaves using spi_set_cs_mode()? Is this documented anywhere? I seems fairly obvious, but I can't find anything and there are no comments in the driver code.
I must say that I'm really enjoying working with the DA14531, and it's definitely living up to it's power consumption expectations, but I find the documentation really challenging.
Lee.
Hi Lee,
You’re correct – when using the SPI interface you have two ways to control the CS line:
Best regards
IM_Dialog
Thanks .. is this documented anywhere?
Hi Lee,
Please take a look at the projects\target_apps\peripheral_examples\spi\spi_flash example of the SDK. The P0_1 is configured as SPI CS in the user_periph_setup.h / .c files. This configuration is passed into the configuration struct for SPI - spi_cfg. Then the application is using the spi_cs_low() and spi_cs_high() APIs from the spi_531.c driver to toggle the CS line. Hope this helps!
Thanks, PM_Dialog
Thanks, but this example is just using SPI_CS0. I was specifically looking for something that documents the use of the GPIO option, but it's ok now as I've tested it myself and have it working as I'd like.
I think I've said it somewhere else as well, but the documentation is shocking, even the basic register level documentation in the datasheet is missing important information, and much of the SDK appears to be undocumented. I love the device, but it's a real struggle to work with the SDK.
It's nice to see so much focus on the forum though ... thank you.
Lee.