We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi to all the members. I have been very impressed by the members answers which encourages me to post my query first time. Good job.
I am trying to communicate between the USB and the device STM32. I have configured the packet size to 64 both receive and sent.
I am transmitting the packet from the PC to board (packet length > 64). In this I got success by receieving the 64 packet each time with termination condition ";" at the end.
Now I also want to transmit a packet gretaer than 64 to PC. but everytime the communication hangs.
the code is pasted below. hope it helps
Board code: printf("%s\n\r",OutReport); if((OutReport[0]=='!') || (OutReport[0]=='K')) { while(count_buffer > 0) { if(OutReport[0]=='K') { for(i=0;i<64;i++) { tempINbuffer[i] = OutputBuffer[init]; init++; } sprintf(InReport,"%s",tempINbuffer); printf("\n\rInreport: %s",InReport); init = init + 1; count_buffer = count_buffer - 64; OutReport[0]='S'; } } } OutputBuffer contains a data greater than 64 characters.
Visual Basic 6 code: Usb_Tx = "K;" Call WriteReport Usb_Rx_temp = "" receive_flag = 1 While receive_flag <> 1 Call ReadReport Usb_Rx_temp = Usb_Rx_temp & Usb_Rx receive_buff = VBA.StrConv(Usb_Rx, vbFromUnicode) For i = 0 To 63 If receive_buff(i) = 59 Then receive_flag = 1 MsgBox receive_buff(i) End If Next Usb_Tx = "K;" Call WriteReport Wend Text1.Text = Usb_Rx_temp
I apologise for the formatting as this message box doesnt support formatting.
Thanks for your time.
thanks for your suggestions. I will take care of this thing in future.
I have made myself the code working. Its working now.