This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/TDA2SX: Communication with external camera using TCP/IP & UDP

Part Number: TDA2SX

Tool/software: TI-RTOS

Hi, I'm working with an TDA2xx and vision_sdk_02_12.


I try to connect an external camera, using Ethernet. The camera sends jpeg-images with 30fps and I'm already able to use the network_tx tool to send single jpeg images from my PC to the EVM and display them.

To start the video-stream of the cam I need to send a control string via TCP/IP to the cam. The cam has a static IP and control port.

Only after the stream request is sent, the camera will start streaming and returns the jpeg-image via UDP to the IP-address from where the request was sent (static IP from EVM and given port).

Now I want to send the streaming request from the EVM to the camera and capture the images also with the EVM to display them. No interaction with PC.

How should I implement this in any given usecase? 

- open TCO & UDP socket

- send stream request

- receive data, decode and display.

I hope you can help me.

Best regards Philipp

  • Hi, Philipp,

    The Ethernet experts have been notified. They will respond here.

    Regards,
    Mariya
  • Hi Philipp,

    Regarding implementation of the following you can have a look at below

    Option 1.

    open TCP & UDP socket
    vision_sdk\src\utils_common\src\network_api.c
    Network_open has implememtation of socket create
    ti_components\networking\ndk_2_25_01_11\docs is the ndk documentation where you will find more details


    send stream request
    Once you have a socket open you can write to same with revelant headers and data as required by camera to stream.
    Network_write in vision_sdk\src\utils_common\src\network_api.c

    receive data
    receive from the socket opened
    Network_read vision_sdk\src\utils_common\src\network_api.c

    Once received data you can pass to decoder link and display link.

    You need to create a Link for UDP/TCP receive . Refer AVBRx link in links_common/avbrx

    We have a usecase for AVB camera capture (IEEE1722) decode and display which you can refer for the usecase generation


    Option 2.

    create a chain with NullSrc -> decode-> display.

    Modify the nullSrcLink_networkRx.c file to add in headers as required by camera.
    But currently nullSrcLink_networkRx.c doesn't support udp receive. you may have to enhance the same to have a UDP support .

    nullSrcLink_networkRx.c underneath uses the vision_sdk\src\utils_common\src\network_api.c
    network api only.


    Regards
    Chetan.M
  • Hi Chetan,

    first of all thanks for your fast reply. I appreciate it!

    I tried to implement your solutions step by step. So I took the given usecase Chains_NetworkRxDecDisplay which uses the nullSrcLink as capture source.
    In the network_api.c I added two new functions, one to connect to a server and one to send data to the server (the camera acts like a server). Than I included the TCP Socket creation inside nullSrcLink_networkRx.c -> NullSrcLink_networkRxCreate(). With that I was able to send the necessary command to the camera.

    But now i I'm unsure with further steps.

    FYI: I'm completely new to work with EVM from TI or any other kind. Same for vision_sdk etc. It is for a study project. So please be considerate with my questions :-) I try to get behind all this...

    If I want to use your explained "option 1", where do I implement all the stuff?

    #1: e.g. in the networkRx usecase the chain is : NullSource -> Decode -> Display.
    Do I need to replace the NullSource with my own comlete new Link, where I open the Sockets? Is this even possible if there is no other capture source?

    #2: You also said that I need to create a Link for UDP receive. With my understanding from #1 I should create one new Link to replace the NullSourceLink.
    Inside will be:
    - Socket creation and sending streaming request via TCP in e.g. mySocketSourceLinkCreate()
    - UDP receive inside some other part of mySocketSourceLink...()?

    Please correct me and my understanding. And I am very glad if you could help me with further questions to this topic!

    Thanks and best regards

    Philipp
  • Hello Philipp,

    Glad you are able to get basic commands working with the cameras. Below are my comments your doubts. Please feel free to ask any questions, we are here to help!

    #1: e.g. in the networkRx usecase the chain is : NullSource -> Decode -> Display.
    Do I need to replace the NullSource with my own comlete new Link, where I open the Sockets? Is this even possible if there is no other capture source?

    [PYJ] You dont need to replace NullSource link, you just need to add support for UDP in the link. If you look for all data types supported by null source it can support file read, network, memory read etc. You just need to add UDP support. May be NULLSRC_LINK_DATA_RX_MODE_UDP can be defined. Then add all your UDP capture code under this data type. You can follow same approach as of TCP case.

    #2: You also said that I need to create a Link for UDP receive. With my understanding from #1 I should create one new Link to replace the NullSourceLink. 
    Inside will be:
    - Socket creation and sending streaming request via TCP in e.g. mySocketSourceLinkCreate()
    - UDP receive inside some other part of mySocketSourceLink...()?

    [PYJ] Yes, no need to create new link, also as mentioned earlier no need to remove TCP also. Just add new data type and you should be good to use it for UDP related development across null source link

  • Hi Prasad,

    thank you for your reply!

    I just implemented my own Link which is a identical copy of the NullSrcLink. And use it in the NetworkRxDecDisplay Usecase. I only did this to work independent from NullSrcLink so changes do not effect working Usecases.

    Now I'm going to implement your suggestions.

    But the NetworkRxDecDisplay-Usecase does communicate with the Host Network_tx Tool and exchanges Information about the size of the Picture and some NetworkRx_CmdHeader with the magic number 0x1234ABCDU.

    My camera will not send any of this, so I think I need to make some more changes than only add a new data type.

    I keep tho Topic open and reply with new results.

    Thanks again for your support!

    Regards, Philipp
  • Hi, 

    I finaly managed to get all the stuff runnig.

    Like you said, I implemented a new DataType and made some other changes. It works fine now.

    There are now some performance issues which I need to figure out.

    Thanks for your help! I'm really grateful

    Best regards 

    Philipp