AnsweredAssumed Answered

PN7462 HIF-SPI Tx is not work!

Question asked by W.Y. YI on Aug 16, 2018
Latest reply on May 16, 2019 by Amol Borase



I'm using the PN7462AU. And want to communicate with another MICOM via HIF SPI slave mode.

Rx is working. When I sent from host - I mean another MICOM - to PN7462, received successfully. But try to receive from PN7462, I can't.

When I call the "phhalHif_Transmit()", first call returns "PH_ERR_SUCCESS". But can not receive any data. After the second call returns "PH_ERR_HIF_TX_BUFFER_LOCKED". I don't know why.

This is my code.



#define _4X_BUF_SIZE   64
uint32_t _4rx_buf_[_4X_BUF_SIZE];
void HIF_SPI_Init() {
    phhalHif_Config_t   hif_config = {
        .sConfig.sSpiConfig = _CPOL_LOW | _CPHA_ODD,
        .bTimeout       = 100,//0,
        .eInterface     = E_HIF_SPI,
        .eBufferType    = E_BUFFER_FORMAT_FREE,
        .bShortFrameLen = 0,
        .bStoreErrData  = 0,
        .bHeaderSize    = 0
    phhalHif_Init(&hif_config, _hif_error_callback);
    phhalHif_InitRxBuffer(E_RX_BUFFER_ID0, _4X_BUF_SIZE * 4, _4rx_buf_, _hif_rx_callback);

static void _hif_tx_callback(uint32_t status, void *param) {
    tx_size_ = status;

int16_t HIF_TX_Timeout(uint8_t *stream, int16_t size, uint32_t timeout_ms) {
    tx_size_ = 0;
    memcpy((uint8_t*)_4tx_buf_, stream, size);
    if (phhalHif_Transmit(_4tx_buf_, size, _hif_tx_callback) == PH_ERR_SUCCESS) {
        // assert the IRQ line to sync with master
        while ((tx_size_ == 0) && (timeout_ms-- > 0))
       // de-assert the IRQ line to sync with master
        // first time return here
        return tx_size_;
    // second, third, .. returns here
    return 0;



Again, when I call the "HIF_TX_Timeout()" function, it returns two types.

First call, returns tx_size_. And others return 0. And never Tx.


Help me.


Sorry for my poor english. I hope you can read this.