Set DA14683(AQFN) USB pin P1_1 & P2_2 as SPI MOSI & MISO pin

⚠️
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 https://www.dialog-semiconductor.com/support . We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
kuda
Offline
Last seen: 1 year 1 month ago
Joined: 2020-03-21 14:58
Set DA14683(AQFN) USB pin P1_1 & P2_2 as SPI MOSI & MISO pin

HI! PM_Dialog,

 

      I have custom DA14683 boards and got problem about set DA14683(AQFN) USB pin P1_1 & P2_2 as SPI MOSI & MISO pin.

      For pcb layout issue, my custom board need to setup P1_1(USB pin) & P2_2(USB pin) as SPI MOSI & MISO pin.

      I had trace SPI MOSI & MISO signal output and input by oscilloscope. It can trace waveform to verify hardware is work.

      But I can't get any data from SPI read function.

      I have try to set USB pin P1_1 as SPI MOSI and  P4_0 as SPI MISO pin. Then I can receive data from SPI read function.

      My question is

      Can DA14683 USB pin P1_1 & P2_2  setup as SPI MOSI & MISO pin by call REG_SET_BIT(CRG_PER, USBPAD_REG, USBPAD_EN); . ?

 

 

      My code, as below.

      REG_SET_BIT(CRG_PER, USBPAD_REG, USBPAD_EN);
//SPI
        hw_gpio_set_pin_function(HW_GPIO_PORT_MT6381_SPI_CLK, HW_GPIO_PIN_MT6381_SPI_CLK, HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_SPI_CLK);

        hw_gpio_set_pin_function(HW_GPIO_PORT_MT6381_SPI_DI, HW_GPIO_PIN_MT6381_SPI_DI, HW_GPIO_MODE_INPUT, HW_GPIO_FUNC_SPI_DI);
        hw_gpio_set_pin_function(HW_GPIO_PORT_MT6381_SPI_DO, HW_GPIO_PIN_MT6381_SPI_DO, HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_SPI_DO);
        hw_gpio_set_pin_function(HW_GPIO_PORT_MT6381_SPI_CSN, HW_GPIO_PIN_MT6381_SPI_CSN, HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_SPI_EN);
        hw_gpio_set_active(HW_GPIO_PORT_MT6381_SPI_CSN, HW_GPIO_PIN_MT6381_SPI_CSN);

       

        ....

 

        mt6381_spi_handle = ad_spi_open(MT6381_SPI);

        spi_tx_buf[0] = SPI_CR_CMD;
        spi_tx_buf[1] = reg;
        spi_tx_buf[2] = addr;
        spi_tx_buf[3] = (data_size & 0xFF) - 1;
        spi_tx_buf[4] = (data_size & 0xFF00) >> 8;
        spi_tx_buf_data_size = 5;

        ad_spi_write(mt6381_spi_handle, spi_tx_buf, spi_tx_buf_data_size);

        memset(spi_tx_buf, 0, SPI_BUFFER_LEN);
        spi_tx_buf[0] = SPI_RD_CMD;
        spi_tx_buf_data_size = 1;
        ad_spi_transact(mt6381_spi_handle, spi_tx_buf, spi_tx_buf_data_size, spi_rx_buf, data_size);
        OS_DELAY_MS(SPI_DMA_CALLBACK_IDLE_TIME_MICROSECOND);
        memcpy(data_buf_ptr, spi_rx_buf, data_size);
        ad_spi_close(mt6381_spi_handle);

                                                    TKS

                                                                                   kuda

Device: 
PM_Dialog
Offline
Last seen: 2 months 2 weeks ago
Staff
Joined: 2018-02-08 11:03
Hi kuda,

Hi kuda,

According to DA14683 datasheet and section 32.5 SPECIAL I/O CONSIDERATIONS :

 " To use P1_1 or P2_2 in GPIO mode, USBPAD_REG[USBPAD_EN] must be set. However, the allowed levels on this pins are 0V and the voltage on V33 rail. If 1.8V is selected as the pin supply, then a current of 150 uA is to be expected. Moreover, these pins should not be used in sleep modes because the USBPAD_REG will be powered off (belongs to the peripheral power domain). "

Both can be used with the 3.3V supply rail only, so both cannot be powered in sleep mode. Are you using the DA14683 in sleep or in active mode?

Additionally, when these pins are used as GPIOs make sure that USB logic is deactivated.

#define dg_configUSE_USB_ENUMERATION            (0)
#define dg_configUSE_USB                        (0)

Thanks, PM_Dialog