Fix the RTS signal handling for Pelagic interface
The RTS signal needs to be low before it is raised, and not just set. This ensures that the PIC inside the Pelagic PC interface is reset and the initialization sequence always starts cleanly, regardless of the previous state of the signal. Reported-By: Bill Perry <bperrybap@opensource.billsworld.billandterrie.com>
This commit is contained in:
parent
96949627aa
commit
6e87c1d7b7
@ -661,21 +661,37 @@ oceanic_atom2_device_open (dc_device_t **out, dc_context_t *context, dc_iostream
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Give the interface 100 ms to settle and draw power up.
|
||||
// Set the DTR line.
|
||||
status = dc_iostream_set_dtr (device->iostream, 1);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (context, "Failed to set the DTR line.");
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Clear the RTS line to reset the PIC inside the data cable as it
|
||||
// may not have have been previously cleared. This ensures that the
|
||||
// PIC will always start in a known state once RTS is set. Starting
|
||||
// in a known default state is very important as the PIC won't
|
||||
// respond to init commands unless it is in a default state.
|
||||
status = dc_iostream_set_rts (device->iostream, 0);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (context, "Failed to clear the RTS line.");
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Hold RTS clear for a bit to allow PIC to reset.
|
||||
dc_iostream_sleep (device->iostream, 100);
|
||||
|
||||
// Set the DTR/RTS lines.
|
||||
status = dc_iostream_set_dtr(device->iostream, 1);
|
||||
// Set the RTS line.
|
||||
status = dc_iostream_set_rts (device->iostream, 1);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (context, "Failed to set the DTR line.");
|
||||
goto error_free;
|
||||
}
|
||||
status = dc_iostream_set_rts(device->iostream, 1);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (context, "Failed to set the DTR line.");
|
||||
ERROR (context, "Failed to set the RTS line.");
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Give the interface 100 ms to settle and draw power up.
|
||||
dc_iostream_sleep (device->iostream, 100);
|
||||
|
||||
// Make sure everything is in a sane state.
|
||||
dc_iostream_purge (device->iostream, DC_DIRECTION_ALL);
|
||||
|
||||
|
||||
@ -272,6 +272,20 @@ oceanic_veo250_device_open (dc_device_t **out, dc_context_t *context, dc_iostrea
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Clear the RTS line to reset the PIC inside the data cable as it
|
||||
// may not have have been previously cleared. This ensures that the
|
||||
// PIC will always start in a known state once RTS is set. Starting
|
||||
// in a known default state is very important as the PIC won't
|
||||
// respond to init commands unless it is in a default state.
|
||||
status = dc_iostream_set_rts (device->iostream, 0);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (context, "Failed to clear the RTS line.");
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Hold RTS clear for a bit to allow PIC to reset.
|
||||
dc_iostream_sleep (device->iostream, 100);
|
||||
|
||||
// Set the RTS line.
|
||||
status = dc_iostream_set_rts (device->iostream, 1);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
|
||||
@ -442,6 +442,20 @@ oceanic_vtpro_device_open (dc_device_t **out, dc_context_t *context, dc_iostream
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Clear the RTS line to reset the PIC inside the data cable as it
|
||||
// may not have have been previously cleared. This ensures that the
|
||||
// PIC will always start in a known state once RTS is set. Starting
|
||||
// in a known default state is very important as the PIC won't
|
||||
// respond to init commands unless it is in a default state.
|
||||
status = dc_iostream_set_rts (device->iostream, 0);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (context, "Failed to clear the RTS line.");
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Hold RTS clear for a bit to allow PIC to reset.
|
||||
dc_iostream_sleep (device->iostream, 100);
|
||||
|
||||
// Set the RTS line.
|
||||
status = dc_iostream_set_rts (device->iostream, 1);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user