AnsweredAssumed Answered

USB: how to increase the input and output receive buffer

Question asked by bruzzi.manfredo on Dec 2, 2014

I designed my own application starting from VirtualComport_loopback example project.
I have a modbus client protocol running on USB and using CDC_Send_DATA() and CDC_Receive_DATA() send and get data from PC virtual comm. port.
I have problems with modbus commands with read and/or writes longer that 64 bytes. I resolved the output problem splitting the answer into 64 bytes blocks. I wonder if I can do the same thing with input or increase the input buffer to 256 bytes (max. protocol message length).

Here is some piece of code:
uint32_t CDC_Send_DATA (uint8_t *ptrBuffer, uint16_t Send_length)
  uint8_t len;
  uint8_t *buff = ptrBuffer;

  packet_sent = 0;
  while (Send_length)
    if (Send_length < 64) len = Send_length;
    else len = 64;
    /* send  packet to PMA*/
    UserToPMABufferCopy((unsigned char*)buff, ENDP1_TXADDR, len);
    SetEPTxCount(ENDP1, len);
    Send_length -= len;
    buff += len;

  return 1;