Search found 13 matches

by cemox
Wed Jan 02, 2019 8:56 am
Forum: General Discussion and Questions
Topic: UART serial flush (!)
Replies: 7
Views: 449

Re: UART serial flush (!) SOLVED

I solved it by making a modification to machine_uart.c file as this : I added internal function call uart_flush(self->uart_id); into uart.write function in machine_uart.c file as shown below: STATIC mp_uint_t pyb_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) { pyb_ua...
by cemox
Wed Jan 02, 2019 7:07 am
Forum: General Discussion and Questions
Topic: UART serial flush (!)
Replies: 7
Views: 449

Re: UART serial flush (!)

Thank you Dave. I have ESP8266 board. I do not think buffer size is a key factor here, because UART has its own hardware, whatever is written to tx buffer is sent asynchronously. The actual data I am sending to Dynamixel motors is only 26 bytes long, but the problem is still the same. Naturally, ESP...
by cemox
Tue Jan 01, 2019 2:49 pm
Forum: General Discussion and Questions
Topic: UART serial flush (!)
Replies: 7
Views: 449

Re: UART serial flush (!)

This is an important problem. I wrote a test code like this : mypin.on() uart1.write("this is a very long sententence") mypin.off() In the image, the red signal show UART1 TX pin and the yellow signal shows the state of the output pin (mypin). Since the UART has its own hardware, the output pin's st...
by cemox
Tue Jan 01, 2019 12:21 pm
Forum: General Discussion and Questions
Topic: UART serial flush (!)
Replies: 7
Views: 449

Re: UART serial flush (!)

Thanks for the hint, it is a good approach. I think you accessed the register by using inline assembly code. I'll try to figure out if I can do it for ESP8266.
by cemox
Sun Dec 30, 2018 3:24 pm
Forum: General Discussion and Questions
Topic: UART serial flush (!)
Replies: 7
Views: 449

UART serial flush (!)

Hi, I am working on a project that communicates with a device via UART in half-duplex mode. The hardware for half-duplex communication works fine. My ESP module pulls control line that is connected to the 74LS241 IC high before sending the command string and pulls it back to low in order to receive ...
by cemox
Fri Oct 12, 2018 4:13 am
Forum: ESP8266 boards
Topic: sending hex via UART
Replies: 7
Views: 495

Re: sending hex via UART

Thank you Robert :)
by cemox
Thu Oct 11, 2018 6:01 pm
Forum: ESP8266 boards
Topic: sending hex via UART
Replies: 7
Views: 495

Re: sending hex via UART

But, I have a different problem now. data = [0xff, 0xff, 0xfd, 0x25] ax = bytes(data) len(ax) >> 4 where as data = [0xff, 0xff, 0xfd, 0x25] ax = b"".join(b'\\x%2x' % b for b in data) len(ax) >> 16 it treats the array items separately, uart sends 16 characters instead of 4. I am stuck in the middle o...
by cemox
Thu Oct 11, 2018 3:59 pm
Forum: ESP8266 boards
Topic: sending hex via UART
Replies: 7
Views: 495

Re: sending hex via UART

Sorry my mistake, I checked what is sent to the other side by terminal program, backslashes are single but there are missing zero's, think it is the problem. this is what I captured: '\xff\xff\xfd\x 0\xfe\x 6\x 0\x 3\x19\x 0\x 4\xc1\x25' there are blanks instead of zero's. I think (%02) b"".join(b'\...
by cemox
Thu Oct 11, 2018 2:56 pm
Forum: ESP8266 boards
Topic: sending hex via UART
Replies: 7
Views: 495

Re: sending hex via UART

Thank you Robert, good approach, but the receiving party accepts only in this format:
b'\xff\xfd' etc. i.e. with single backslash.
by cemox
Thu Oct 11, 2018 11:55 am
Forum: ESP8266 boards
Topic: sending hex via UART
Replies: 7
Views: 495

sending hex via UART

hi, I am trying to send hex data to a device from my nodemcu board in the "\xff\x00" format. Below code perfectly produces the hex string without any problem: data = [0xff, 0xff, 0xfd, 0x00] print(bytes(data)) it sends b'\xff\xff\xfd\x00' which is understandable by the receiving party. But, when the...