Hi,
I'm using NRF52840 sdk v15 with Softdevice.
I have multiple SPIM instances and I make sure they are never active at the same time.
Can I share the pins (except the CS one) between the instances?
Thanks,
Daniel
Hi,
I'm using NRF52840 sdk v15 with Softdevice.
I have multiple SPIM instances and I make sure they are never active at the same time.
Can I share the pins (except the CS one) between the instances?
Thanks,
Daniel
"If the answer is yes, this might efficiently emulate daisy chaining."
I'm not quite following what you are trying to achieve. You do not need multiple SPIM instances sharing the same IOs, one SPIM instance is enough. It's a bus after all. The answer is yes, you can, but I do not understand why you would want to.
You should rather check out the SPI transaction manager documentation and SPI transaction manager API, as well as the SPI Transaction Manager Example.
I'm comfortable with the SPIM driver interface and I would like to keep using it (rather than manipulate registers directly). Since there is no interface to daisy chaining there I figured out I can keep simpler wiring while minimizing power consumption. Does this make sense to you?
Thanks,
Daniel
What do you mean by daisy chaining? All slaves already share the IO lines with the exception of the CS line...
If you want to change the CS pin you can call nrf_spim_csn_configure, or use the SPI transaction manager.
1. Can I use nrf_spim_csn_configure also with the SPIM driver library to dynamically change the CS?
2. Using the SPIM driver library, I don't need to specify the duration parameter. Can you advise on the best way to determine this parameter?
Thanks,
Daniel
1. Yes, thought not during a transfer.
2. It is given by the Slaves timing specification. I would start with 0 and if that does not work, increase until it does. I suggest you use a digital analyzer during this development.
Thanks again! I did indeed find the min duration for my slaves.
The SPI mode varies among my slaves. Can I also change it (and keep using the driver library)?
Thanks,
Daniel
Thanks again! I did indeed find the min duration for my slaves.
The SPI mode varies among my slaves. Can I also change it (and keep using the driver library)?
Thanks,
Daniel
Yes, with a call to nrf_spim_configure.
This is basically what the spi transaction manager library does. It lets you define different configuration and swap between them, in addition to a basic queuing scheduler.
Thanks!
From the documentation at
Table 3
it seems that our discussion (and especially regarding the CS) applies only to SPIM3 (and not to SPIM0..SPIM2). Am i right?
Thanks again!
Daniel
Yeah, you're right. The SPIM0-2 uses SW Chip Select and you'll have to uninit and then re-init the driver with the new configuration (CS/SS pin and whatever else you want to change) whenever you want to address another slave.
Many thanks! Your help has been most valuable, Daniel