This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to configurate transmitter/receiver radio?

hi , i want to modify the "transmitter_pca10028" and "receiver_pca10028" examples in SDK to obtain a transmitter/receiver in the same time (tranceiver). So someone have idea how can i do this . thx

Parents
  • I have not tried it myself but it should be fairly straight forward to merge this examples.

    Thing to take into consideration while merging is the packet pointer for NRF_RADIO->PACKETPTR. you have to configure this register everytime you send and receive data, so its best to have

    static uint32_t     tx_packet;              /**< Packet to transmit. */
    static uint32_t     rx_packet;              /**< Packet to transmit. */
    

    also change

    void send_packet()
    {
         // Set payload pointer
         NRF_RADIO->PACKETPTR = (uint32_t)&tx_packet;
    
        // send the packet:
        NRF_RADIO->EVENTS_READY = 0U;
        NRF_RADIO->TASKS_TXEN   = 1;
    
        while (NRF_RADIO->EVENTS_READY == 0U)
        {
            // wait
        }
        NRF_RADIO->EVENTS_END  = 0U;
        NRF_RADIO->TASKS_START = 1U;
    
        while (NRF_RADIO->EVENTS_END == 0U)
        {
            // wait
        }
    
        uint32_t err_code = bsp_indication_text_set(BSP_INDICATE_SENT_OK, "The packet was sent\n\r");
        APP_ERROR_CHECK(err_code);
    
        NRF_RADIO->EVENTS_DISABLED = 0U;
        // Disable radio
        NRF_RADIO->TASKS_DISABLE = 1U;
    
        while (NRF_RADIO->EVENTS_DISABLED == 0U)
        {
            // wait
        }
    
         // Set payload pointer  to receive
         NRF_RADIO->PACKETPTR = (uint32_t)&rx_packet;
    }
    

    The rest are minor porting challenges.
    Note that if you are testing this changes you need another transceiver which has to do transmit and receive in reverse order than the DeviceUnderTest.

Reply
  • I have not tried it myself but it should be fairly straight forward to merge this examples.

    Thing to take into consideration while merging is the packet pointer for NRF_RADIO->PACKETPTR. you have to configure this register everytime you send and receive data, so its best to have

    static uint32_t     tx_packet;              /**< Packet to transmit. */
    static uint32_t     rx_packet;              /**< Packet to transmit. */
    

    also change

    void send_packet()
    {
         // Set payload pointer
         NRF_RADIO->PACKETPTR = (uint32_t)&tx_packet;
    
        // send the packet:
        NRF_RADIO->EVENTS_READY = 0U;
        NRF_RADIO->TASKS_TXEN   = 1;
    
        while (NRF_RADIO->EVENTS_READY == 0U)
        {
            // wait
        }
        NRF_RADIO->EVENTS_END  = 0U;
        NRF_RADIO->TASKS_START = 1U;
    
        while (NRF_RADIO->EVENTS_END == 0U)
        {
            // wait
        }
    
        uint32_t err_code = bsp_indication_text_set(BSP_INDICATE_SENT_OK, "The packet was sent\n\r");
        APP_ERROR_CHECK(err_code);
    
        NRF_RADIO->EVENTS_DISABLED = 0U;
        // Disable radio
        NRF_RADIO->TASKS_DISABLE = 1U;
    
        while (NRF_RADIO->EVENTS_DISABLED == 0U)
        {
            // wait
        }
    
         // Set payload pointer  to receive
         NRF_RADIO->PACKETPTR = (uint32_t)&rx_packet;
    }
    

    The rest are minor porting challenges.
    Note that if you are testing this changes you need another transceiver which has to do transmit and receive in reverse order than the DeviceUnderTest.

Children
No Data
Related