⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
5 posts / 0 new
Last post
essele
Offline
Last seen:3 months 3 weeks ago
加入:2020-12-19 15:33
SPI CS as FUNC_GPIO???

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.

IM_Dialog
Offline
Last seen:1 month 2 weeks ago
加入:2016-12-06 22:25
Hi Lee,

Hi Lee,

You’re correct – when using the SPI interface you have two ways to control the CS line:

  1. Use the SPI_CS0 or SPI_CS1 function of the GPIO. To do this you select the CS output using the spi_set_cs_mode function.
  2. 或者您可以使用任何GPIO, use the spi_set_cs_mode function with the SPI_CS_GPIO option and then control the GPIO manually.

Best regards

IM_Dialog

essele
Offline
Last seen:3 months 3 weeks ago
加入:2020-12-19 15:33
Thanks .. is this documented

Thanks .. is this documented anywhere?

PM_Dialog
Offline
Last seen:5 days 6 hours ago
Staff
加入:2018-02-08 11:03
Hi Lee,

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

essele
Offline
Last seen:3 months 3 weeks ago
加入:2020-12-19 15:33
Thanks, but this example is

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.