sharc 21569 set SPI2_RDY pin as GPIO.

Hello .

I have a trouble on sharc 21569 about using SPI2_RDY pin as GPIO output. In my application , I also need also use PB_05/SPI2_RDY pin to notify external MCU after SPI2 slave boot is complete.  But the problem is after I set the PB_05 as output high or low, the PB_05 pin has nothing changes.

My code pieces as below:

*pREG_SPU0_SECUREP32= 0x3; //PORTA
*pREG_SPU0_SECUREP33= 0x3; //PORTB
*pREG_SPU0_SECUREP34= 0x3; //PORTC

#define GPIO_MEMORY_SIZE (ADI_GPIO_CALLBACK_MEM_SIZE*2)
static uint8_t gpioMemory[GPIO_MEMORY_SIZE];

ADI_GPIO_RESULT result;
/* Initialize the GPIO driver and allocate memory for callbacks*/
result = adi_gpio_Init((void*)gpioMemory,GPIO_MEMORY_SIZE,NULL);

result = adi_gpio_Clear(ADI_GPIO_PORT_B,ADI_GPIO_PIN_5);
result = adi_gpio_SetDirection(ADI_GPIO_PORT_B,ADI_GPIO_PIN_5, ADI_GPIO_DIRECTION_OUTPUT);
adi_gpio_Set(ADI_GPIO_PORT_B,ADI_GPIO_PIN_5);
adi_gpio_Clear(ADI_GPIO_PORT_B,ADI_GPIO_PIN_5);   //there is nothing changes.

I am sure hardware connection is no problem ,because slave boot is OK.

Thanks a lot.

  • Hi,

    The SPI_RDY pin is controlled by SPI_slave, SPI_RDY pin will get asserted and de-asserted based on the SPI slave state(ready/busy). As per ADSP-2156x HRM the slave SPI_RDY pin should connected to SPI host FLAG/interrupt pin.

    1) Can you explain the issue? Is the issue occurs when notifying the external MCU once the SPI slave boot is finished ?

    2) Are you using PB_05/SPI2_RDY pin for both SPI host/slave and external MCU?

    3) Can you explain the setup? Is the setup contains SPI host/master board, SPI slave board and external MCU?

    4) If you are facing issues with notifying external MCU after SPI slave boot, The PB_05/SPI2_RDY pin is pulled up using a resistor, by default SPI2_RDY pin will be high and when the slave is ready it will make the SPI_RDY pin low. So you can't able to drive the pin low, which is already high.

    Regards,
    Anand Selvaraj.

  • thank you for your reply!


    1) What I mean is that spi2 has been started from the start, but I want to continue to use the IO pin PB_05 as a general-purpose GPIO output pin in the DSP application, and it is still the external ARM pin of the connector.


    2) From the start has been completed, and then run my application, this is no problem. However, in my application, PB05 will be configured as an output pin, and then output high or low. The problem is that it is always high and cannot be pulled low.


    3) In addition to PB05, I also tried to change a pin to PC_07, but it is still the same. I saw that PC_07 is multiplexed with SYS_F. I'm not sure if these two pins can't be used in the application. Use it as an IO pin. Because other pins are possible.

  • Hi,

    1) Can you clear the values of mux and FER register(*pREG_PORTx_MUX and *pREG_PORTx_FER)?

    2) The default PC_07 pin function is SYS_FAULT until the PORTC_FER and PORTC_MUX registers are explicitly programmed to change it.

    3) Is the PB_05 pin toggling in debug time?

    Regards,
    Anand Selvaraj.

  • Hi.
    1) Yes, I can read and write PORTB or PORTC registers normally. Below is my PORTC register. PC_07 cannot be pulled up or down, but the registers mux and fer can be read and written normally. I have enabled PC_0 and PC_4 here. These two pins work normally without any problems, but PC_07 cannot be pulled high or low.


    2) I will not switch the IO pins in my application, because the hardware is wired to connect PB_05 and PC_07 to the external ARM. PB_05 is used for slave startup control. So I wanted to use PC_07, but when I found that it didn't work, I thought about changing to PB_05. Later I found that neither of these two pins can be used as GPIO to pull up or pull down.

  • Hi,

    In order to debug further, try with LED blink application( use the non working PB_05 pin, PC_07, some other GPIO pin which is working ) using SPI slave boot and probe the GPIO pins.

    Is it possible to check the PB_05,PC_07 pins without connecting external ARM after SPI slave boot is finished?

    Regards,
    Anand Selvaraj.