AnsweredAssumed Answered

Getting started with blackfin SPI library

Question asked by verysmallbits on Apr 5, 2017
Latest reply on May 5, 2017 by Jithul_Janardhanan

I'm trying to get going with the blackfin SPI library, but I have so many questions that I feel like I must be missing a key piece of documentation.  The "documentation" simply explains the function calls but does not provide any guidance on how to use the libary as a whole.

 

the task : I'm trying to do simple SPI transmits to multiple devices. I have 3 devices on SPI1 and each has it's own select line.  The transfers are simple and not time sensitive, i.e. i can block, waiting on the transfers to complete. so interrupt mode and no need for DMA.

 

1 does each transfer require an open close for each device transfer, or can you just open the spi device and leave it open ? why would i ever close it (understanding that the operational mode would stay the same) ?

2 how do i handle the separate SS for each device ? do i open a separate device handle for each one, and then set the desired SS setting ?

4 one of the devices I'm accessing uses a GPIO pin as the SS. How is that handled ?  i would have to disable using any slave select in the library, but i'm not seeing that there's a way to do that.  Well maybe.  It looks like i would disable HW mode and simply use manualSlave select - then use my GPIO pin ?

5 how does the spi device/SS numbering work.  the hardware is spi1, spi2.  but the device handle seems to start at 0. is 0 spi1 ? (I'm assuming that it is).  the docs talk about setting SS from 0 to 7, but in the hardware docs, it's spi1/spi2 and spi_selb[1-3]. So how is spi2/spi_selb3 set ?

 

hDevice = adi_spi_Open(0, ...)

adi_spi_SetSlaveSelect(hDevice, 2, ...)

 

yes, these are really basic questions and it seems to me should already be documented somewhere, but I'm not finding it...

 

Thank you for any advice.

Outcomes