B4R Question SOLVED CTS/RTS protocol using VDrive2.

tigrot

Well-Known Member
Licensed User
Longtime User
Hi everybody
I'm testing a file write on USB driver VDrive2 (vinculum).
I've connected to UART 2 and connected pin RTS and CTS to port 30 an 31.
I use a sub to send commands:
B4X:
Sub com2(tosend As String)
    Log("Tosend:",tosend," ",ctr.DigitalRead)
'    Do While ctr.DigitalRead=True
'       
'    Loop
    astream2.Write(tosend)  
End Sub
If I comment the do loop the program reaches the end but there is buffer overflow, while if decomment the progam stops after a few commands and never restarts.
The CTR in the first test first is 0 then becomes 1 and finaly returns 0.
It seems that the loop doesn't really read input.
Any idea?
Best regards
Mauro Zanin
 

tigrot

Well-Known Member
Licensed User
Longtime User
Yes, it's what it does, the GPIO is always true, after the first few bytes transferred. I have already added a delay.
There are very little documents about this device, no example of real working mass file write.
I refuse to think that such a device has faulty firmware, after many years of development.
Let's further investigate...

Mauro Zanin
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
Hi everybody,
the issue was a kind of deadlock. According to examples I need to assert my RTS(CTS on VDrive2 side) before transmission of data and commands. This blocks transmission from the device. The xmt buffer must be very small since it fills up very quickly, so the device blocks arduino's side by the other CTS/RTS line. My program is waiting for the device to allow transmission and device is waiting for my program to allow it to drain buffer. The perfect deadlock! Another "perfect" example to complicate life to users.
Thank you
Mauro Zanin
 
Upvote 0
Top