nrf5340 is unable to trigger rpmsg(ipc) transfer

Hi,

I have quite demanding SPI device which should send its data over BLE.
Thanks to throughput example i was able to achieve maximum transfer speeds for synthetic tests (without SPI).
Sadly after adding real data input, I noticed that no transfer is executed until I finish my commands. 

Thanks to SystemView I was able to narrow this problem to one part of configuration -> rpmsg.

flow

Colors:

Green -> spi thread
Yellow -> bt_hci thread
Orange -> ble host TX
Red (small squere in top) - IRQ 58 from probably ipc, but i wasnt able to find it in manual (not listed)
Blue - probably openAmp mailing work queue thread
purple - systemwork queue

SystemView Data Log
4010.BleProblem.dat

Here is repo with configs etc.
https://github.com/DuMaM/bitly_nrf5x

Parents
  • Hello,

    I am not sure I understand the question? What are you seeing, and how do you expect it to work?

    I noticed that no transfer is executed until I finish my commands. 

    What sort of commands are you talking about here?

    BR,
    Edvin

  •   Thanks for response, and sorry to not be clear enough. 

    This is what i'm doing here:
    -> I have ads129x communication over SPI. It's set to work in continuous mode, so every n seconds it sends data packet (24bytes). To notify that we should get them it pulls up DATA_READY pin. I detect this in ISR callback and via semaphore i'm notifying SPI thread to read data. (GREEN part in picture)
    -> after SPI read this it send that data via pipe to other thread which is packing up data for BLE transfer, every time i get 251 bytes in this thread I'm sending this with `bt_gatt_write_without_response`. (YELLOW part in picture)

    The question is:
    why it takes so long rpmsg to start transmit data and why there are so big delays between each frame. (BLUE part in picture)

  • Whether or not that is recursive, I am not sure. That is, if you have queued packet #1 and #2 when packet #1 goes on air. Then you queue packet #3 before packet #2 has started airing, I am not sure whether it will change the "more data" bit in packet #2 or not. If not, then all packets needs to be queued before the connection event starts. 

    As far as I can tell, write request is locked since there will be a free space in rpmsg buffer.
    I don't understand why I see only 2 work queue execution per, connection event, even thought I have more data prepared for transmission. I think this is a one of settings from RPMSG. 

    I'm not sure about PPI. My guess is that SPI is taking too long, and I'm unable to provide next packet for BT_TX thread.

  • I also increased systick speed and this didnt helped.

    # clock settings
    # https://github.com/zephyrproject-rtos/zephyr/issues/28469#issuecomment-704164283
    # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/kernel/services/timing/clocks.html
    # https://devzone.nordicsemi.com/f/nordic-q-a/92297/increasing-cpu-clock-frequency-for-bl653
    CONFIG_NRF_RTC_TIMER=n
    CONFIG_CORTEX_M_SYSTICK=y
    CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=64000000
    CONFIG_SYS_CLOCK_TICKS_PER_SEC=6400000
    

  • I believe it is rather the work queue holding you back than the BLE stack. You can try to either skip the work queue, and call the bt_gatt_notify_cb() directly from your spi callback handler.

  • Ok, I added BLE call inside SPI callback.
    https://github.com/DuMaM/bitly_nrf5x/pull/13
    I got even worse performance ;( 

    BTW. I'm using bt_gett_write_without_response, which is under the hood:

    static inline int bt_gatt_write_without_response(struct bt_conn *conn,
    						 uint16_t handle, const void *data,
    						 uint16_t length, bool sign)
    {
    	return bt_gatt_write_without_response_cb(conn, handle, data, length,
    						 sign, NULL, NULL);
    }
    

Reply Children
No Data
Related