This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RL-TCPnet: UDP send/receive from seperate RTX task

Hello,

I'm using RTX + RL-TCPnet on an LPC1788 dev board.

I have the web server enabled and this is working great. In a separate task I have implemented a UDP protocol.

Nothing happens until the following sequence occurs:

All running fine.
UDP message received and validated in dedicated task.
UDP reply sent.
System Hard_faults with an INVPC flag set.

If I receive a message that does not get a reply nothing happens and I can keep receiving.

Is there any reason I would not be able to send and receive UDP packets from a task other than the main_TcpNet task?

Thanks.

M

Parents
  • In my 'network' task I have additional tick handlers:

     while(1)
        {
            main_TcpNet();
            other_custom_tick();
    }
    

    Than in 'other_custom_tick()' I do my non-blocking UDP send receive:

    uint16_t udp_callback(uint8_t socket, uint8_t *remip, uint16_t port, uint8_t *buf, uint16_t len)
    {
        /* This function is called when UDP data has been received. */
    
        if(socket == my_socket())
        {
            if(port == my_get_port())
            {
                if(len <= MAX_MPDU)
                {
                    //tsk_lock();
                    memcpy(rx_buff, buf, len);
                    memcpy(rx_ip_address, remip, 4);
                    cc_len = datalink_receive(&src, &rx_buff[0], MAX_MCC, 1000);  //!\todo define proper timeout somewhere
                    //tsk_unlock();
                }
            }
        }
    
        return (0);
    }
    
    
    void other_custom_tick(void)
    {
        /* process */
        if(cc_len)
        {
           cc_handler(&src, cc_start, cc_len);
            cc_len = 0;
        }
    }
    
    
    

Reply
  • In my 'network' task I have additional tick handlers:

     while(1)
        {
            main_TcpNet();
            other_custom_tick();
    }
    

    Than in 'other_custom_tick()' I do my non-blocking UDP send receive:

    uint16_t udp_callback(uint8_t socket, uint8_t *remip, uint16_t port, uint8_t *buf, uint16_t len)
    {
        /* This function is called when UDP data has been received. */
    
        if(socket == my_socket())
        {
            if(port == my_get_port())
            {
                if(len <= MAX_MPDU)
                {
                    //tsk_lock();
                    memcpy(rx_buff, buf, len);
                    memcpy(rx_ip_address, remip, 4);
                    cc_len = datalink_receive(&src, &rx_buff[0], MAX_MCC, 1000);  //!\todo define proper timeout somewhere
                    //tsk_unlock();
                }
            }
        }
    
        return (0);
    }
    
    
    void other_custom_tick(void)
    {
        /* process */
        if(cc_len)
        {
           cc_handler(&src, cc_start, cc_len);
            cc_len = 0;
        }
    }
    
    
    

Children
No data