weird bug where theres a 100us delay between the transmission of the 3rd and 4th byte of every packet from the pi. this causes the RTS line to sag. must look into

stable
Penguin 2 years ago
parent 26fe06fcc7
commit 638d6e8d5a

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -17,62 +17,5 @@
],
"directory": "/storage/Shared/Projects/Penguinator/pi_serial_bus_manager",
"file": "src/p_serial_bus.cpp"
},
{
"arguments": [
"g++",
"-c",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-DDEBUG",
"-Icfg",
"-Iinc",
"-o",
"build/p_serial_packet.o",
"src/p_serial_packet.cpp"
],
"directory": "/storage/Shared/Projects/Penguinator/pi_serial_bus_manager",
"file": "src/p_serial_packet.cpp"
},
{
"arguments": [
"g++",
"-c",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-DDEBUG",
"-Icfg",
"-Iinc",
"-o",
"build/main.o",
"src/main.cpp"
],
"directory": "/storage/Shared/Projects/Penguinator/pi_serial_bus_manager",
"file": "src/main.cpp"
},
{
"arguments": [
"g++",
"-c",
"-Og",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g3",
"-DDEBUG",
"-Icfg",
"-Iinc",
"-o",
"build/p_idp.o",
"src/p_idp.cpp"
],
"directory": "/storage/Shared/Projects/Penguinator/pi_serial_bus_manager",
"file": "src/p_idp.cpp"
}
]

@ -34,7 +34,7 @@ public:
static ps_packet from_xy(int x, int y);
static ps_packet test_packet();
#ifdef DEBUG
void show_packet();
void show_packet() const;
#endif
private:

@ -44,11 +44,6 @@ ps_bus::ps_bus(const char* dev)
/* Set this flag if you want to receive data even while sending data */
// rs485conf.flags |= SER_RS485_RX_DURING_TX;
if (ioctl(dev_fd, TIOCSRS485, &rs485conf) < 0)
{
printf("ERROR\n");
/* Error handling. See errno. */
}
memset(&toptions, 0, sizeof(toptions));
tcgetattr(dev_fd, &toptions);
toptions.c_cflag &= ~(CSIZE | PARENB);
@ -69,6 +64,11 @@ ps_bus::ps_bus(const char* dev)
tcflush(dev_fd, TCIFLUSH);
// apply
tcsetattr(dev_fd, TCSANOW, &toptions);
if (ioctl(dev_fd, TIOCSRS485, &rs485conf) < 0)
{
printf("ERROR\n");
/* Error handling. See errno. */
}
}
ps_bus::~ps_bus()
@ -83,10 +83,13 @@ ps_bus::~ps_bus()
bool ps_bus::send_pkt(const ps_packet* const pkt)
{
bool ret = true;
pkt->show_packet();
if (write(dev_fd, pkt->data, pkt->msg_len) != pkt->msg_len)
{
ret = false;
}
tcflush(dev_fd, TCIFLUSH);
usleep(1000);
return ret;
}
bool ps_bus::recv_pkt(ps_packet* const pkt)

@ -144,7 +144,7 @@ ps_packet ps_packet::test_packet()
}
#ifdef DEBUG
void ps_packet::show_packet()
void ps_packet::show_packet() const
{
printf("Start Byte:\t\t0x%02x\n", data[0]);
printf("Source Address:\t\t0x%02x\n", *src_addr);

Loading…
Cancel
Save