Post Go back to editing

Multiple ADIN1110 on one microcontroller

Category: Software
Product Number: ADIN1110

I am currently working on a project where I would want multiple ADIN1110's connected to a single microcontroller in order to talk to multiple edge nodes at one time.  However, there seems to be a problem when initializing the second ADIN1110.  When the second one is brought online, it overwrites the configuration of the previous one and reports that the link is down.  Also, transmission of data returns a fail.  I am assuming that this is some sort of driver issue where the second object of the adin1110 class is using memory that the first object uses, causing an overwrite.  Any help would be greatly appreciated.

Parents Reply
  • Hi,

    Have you checked with a digital probe if when doing a write to device 2, CS1 is going low? Device 1 should be ignoring the SPI unless its CS is low during that time.

    Are you using our no-OS device drivers? In that case, have you ported the BSP to your particular board?

    Regards,

    Raquel.

Children
  • Hello,

    I have included a picture below of an oscilloscope reading connected to both of the chip select pins during initialization of the ADIN1110s.  As you can see, the chip select lines are only low when the MCU is sending data, then it is pulled high again.

    As for the drivers, yes, I am using the no-OS drivers.  I am using one of Sparkfun's boards for this project and am using their BSP file that they created for it.  The problem I am having is that the device reports that the boards have been initialized properly, yet when polling the link status of both of the boards, board1, which was initialized first, reports no link.  After some testing, I realized that whichever board is initialized first, will report the link down.  I have a feeling that there is some shared memory problems and the board that is initialized second, is overwriting the memory of the first board.

  • As I look through the driver files further, I noticed in the adin1110_SetUserContext function, the description above states that this function is used for differentiation between instances of the driver.  I assume by this you would mean multiple devices?  If so, I would assume that the driver is capable of multiple ADIN1110s on the same MCU.  The thing that is confusing me now, is how would I modify the BSP to support multiple ADIN1110s.  Even with the example code provided by Analog Devices, the BSP for the STM32 MCU is designed to use one set of pins.  How would this work for attaching interrupts, since I don't see how I could specify in the BSP that there are two interrupt pins for the different ADIN1110s.  Thank you for any help you can provide for modifying the BSP

  • Hi,

    There will be two interrupts one is SPI interrupt from MCU and other one is MAC interrupt from ADIN1110 (INT_N).
    You need to specify GPIO pin number for INT_N interrupt and SPI interface for SPI interrupt in bsp_config.h for both driver instances.

    Followed by you can register link change callback for both driver instances separately using ADIN1110_RegisterCallback.

    Regarding adin1110_SetUserContext API, this is to set user context buffer for application and this buffer is only for application use.

    Regard's,

    Jayapal

  • Hello,

    I understand what you are getting at.  However, I am a bit confused about how to implement something like this.  For instance, if I have multiple variables to store the different Chip Select pins, how would I know which one to use when the BSP_spi_write_and_read() function is called within the BSP.cpp file?  This function is called from the driver itself, and I have no way of determining which instance of the driver is trying to use the SPI bus.  

  • Hi,

    In our example code we are showing just one instance.

    Driver itself is not limited by number of devices but there is need of extra software. It depends on how you are going to use SPI interfaces i.e single SPI with different CS or different SPI chips.

    There could be multiple approaches to archive this. I would recommend to use different BSP read/write call backs for different driver instances. As part of HAL initialization map corresponding spi read/write callback to hDevice instance. For this you may need to pass hDevice instance to HAL.

    #define ADI_HAL_SPI_READ_WRITE(...) HAL_SpiReadWrite(__VA_ARGS__)

    Again it is up to you based on your hardware design.

    Thanks,

    Jayapal