Announcement

Collapse
No announcement yet.

How to re-transmit bad JPG data packets?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to re-transmit bad JPG data packets?

    I am working with the uCAM III via a SPI-2-Serial chip (MAX3100) on the raspberry pi.

    While a direct serial connection between the uCAM and the raspberry pi works fine, we have two issues when using the MAX3100 between the pi and the uCAM III.

    1) the SYNC procedure does not succeed unless we use a 9600 baud setting for the MAX3100 and even then, the resulting "connection" only works (subsequent ack + commands get a valid 6-byte response) some of the time.

    2) about 20% of the data-packets (JPG picture mode) sent from the camera are missing bytes and I can't figure out how to get the missing packets without issuing another GET PICTURE command and re-transmitting all packets, hoping that the corrupt ones are good. Making a complete pass through the data-packets just to resolve the missing ones is very time consuming, and sometimes I need to make 3-4 passes to get all the packets.

    Issue 2 is the one I'd like to solve for now. I've tried using the ACK to indicate which packet id I want (no response from uCAM III unless it is exactly in sequence), sending a NAK instead of an ACK (no error number seems to match), and resending the previous ACK to retry the packet. None of these seem to work.

    The command-set seems rich-enough to permit some kind of re-transmission of specific packets but the data-sheet, while it hints that it might be possible, is not explicit about how to achieve this.

    Any suggestions?

    Thanks,

    nathan

  • #2
    Dear Nathan,

    Welcome to the forum.
    How do you determine that there are some data packets that are missing when issuing get picture command when using max3100? The ACK command is issued by the host controller to uCAM to request for the next package when getting data. This command is can not be use for re-transmission of specific packets.
    Can you share some screenshots of your command and the data that you received from uCAM?

    Thank you.

    Best Regards,
    Ferdinand

    Comment


    • #3
      Thanks for the quick response. Sorry I was wasn't clear. The camera transmits all of the packets sequentially as shown in the data-sheet (correctly, I assume), but some are not received correctly via the MAX3100 to the RPi. I want to re-get only the packets that are corrupt/short (as indicated by their length and embedded checksum). The data sheet says (section 7.9):

      The host can issue this command to request image data package with
      the desired package ID after receiving the DATA command from the uCAM-III.


      And then again (section 7.9.3):
      For acknowledging the DATA command, these two bytes represent the requested package ID.


      It seems like the ACK in response to a data packet is the just received packet id (and any other packet id sent with the ACK seems to result in the camera not responding). As such, it seems like the ACK is an acknowledgement of the received packet and an indication that the next numerical packet id can be sent. As such, I don't understand the "request image data package with *the desired* package ID" and "*the requested* package ID".

      Section 7.10 (NAK) says:
      This command indicates corrupted transmission or unsupported features.


      which seems ideal (instead of an ACK indicating the next packet can be sent). But none of the "error numbers" (7.10.2) seem to apply (I tried: Send Picture Error: F5h).

      However, regardless of the documentation, the question still stands - how can I ask for specific packet ids (that didn't arrive at the RPi correctly) rather than requesting the whole sequence again?

      I'll get things set up again shortly and replay a sequence to show the issue more explicitly.

      Thanks,

      - n
      Attached Files
      Last edited by edwardsnj; 14 June 2022, 05:38 AM. Reason: Add log file

      Comment

      Working...
      X