i was hoping to get some better ways of implementing the serial module. I read and write data just fine. But... reading data (2 hops/jumps = via USB and the trough SPI, then through SPI again) it takes time. I havent measured the time it takes with a oscillator yet, because i think my python code could somewhat improve.
Meaning that i think i need to work with the mcu buffer. (as the USB interface have a buffer of 127 bytes) But the space to work with a buffer is limited.
To get to the point. My code reads one byte of data at the last node via a [command] + [address]. This is sent by the serial module and the data @ address is received.
Though, when reading multiple bytes (271 bytes of data ~ 100b/s) it takes a couple of seconds. This is too long. I know my step is to implement a buffer in the mcu, and then send like 96 bytes of data out to the USB and into the python. I at least believe this will speed up the data flow.
is use serial.readline and the transfer is completed with an '\n'
But what is the fastest way of writing data ? I currently use serial.write.
I know that much lies within the assembly code, and the proper usage of the buffer itself (one question is to know if the USB interface dumps the hole buffer onto the mcu, and if it cant handle the amount of data within time, it gets lost. But my concern now is if i use the python serial module at its best ?! :-/
So my question is: Is there a better way, or an optimal way of using the python serial module ?