Sending python file from STM32 to XBEE
Sending python file from STM32 to XBEE
Hi,
I am trying to send simple.py and robust.py from the STM32 board to the XBee module under micropython mode using a serial port.
I found that when the data is received on the XBee the indentation is corrupted. Hence, Micropython on XBee can't run the python file transferred.
Is there a way to transfer the python file as it is where it retains indentation using STM32 over serial?
I am trying to send simple.py and robust.py from the STM32 board to the XBee module under micropython mode using a serial port.
I found that when the data is received on the XBee the indentation is corrupted. Hence, Micropython on XBee can't run the python file transferred.
Is there a way to transfer the python file as it is where it retains indentation using STM32 over serial?
Re: Sending python file from STM32 to XBEE
Can you provide more information about how you're transferring the file? Maybe post your code or commands?
Re: Sending python file from STM32 to XBEE
Does pyboard.py work with the XBee? If so, I have a little script that can generate python source files which might work for you.
Re: Sending python file from STM32 to XBEE
YesDoes pyboard.py work with the XBee?
Re: Sending python file from STM32 to XBEE
I have an STM32 microcontroller that is connected with XBee over serial port.
I need to send MQTT library files which are simple.py and robust.py to XBee flash.
Step 1.Store all the contents of the python files to an array. (I also tried storing each line to a string)
Step 2. Open the serial port, park XBee under micropython mode, and invoke f.write () under which write the data line by line with all the spaces and indentation.
Step3. The file gets transferred but the indentation gets corrupted for some of the blocks in the python file.
I am stuck on this for the last 2 weeks.
If needed I can submit the code and the output file.
I would appreciate your help.
I need to send MQTT library files which are simple.py and robust.py to XBee flash.
Step 1.Store all the contents of the python files to an array. (I also tried storing each line to a string)
Step 2. Open the serial port, park XBee under micropython mode, and invoke f.write () under which write the data line by line with all the spaces and indentation.
Step3. The file gets transferred but the indentation gets corrupted for some of the blocks in the python file.
I am stuck on this for the last 2 weeks.
If needed I can submit the code and the output file.
I would appreciate your help.
Re: Sending python file from STM32 to XBEE
So you want to send two python scripts to the XBEE. And you want top send them from a STM32 micro. May I ask you why you do not use a PC to send the file over USB to the XBEE? That is the most simple version, either using the XCTU tool or pyboard.py.
With respect to the messed up indentation: did you check that the simple.py and robust.py have not tab and space characters mixed for indentation? That is always a source of trouble. Otherwise, characters may get lost on a serial link without flow control. But that would not happend only for whitespace characters like tab and space.
And yes: Please proved the code and the output file. Use the code button or the marks to enclose it. Or just embed it into your post as a zip file.
With respect to the messed up indentation: did you check that the simple.py and robust.py have not tab and space characters mixed for indentation? That is always a source of trouble. Otherwise, characters may get lost on a serial link without flow control. But that would not happend only for whitespace characters like tab and space.
And yes: Please proved the code and the output file. Use the code button or the marks to enclose it. Or just embed it into your post as a zip file.
Re: Sending python file from STM32 to XBEE
Yes, I want to send two python file from STM32 to XBee.
I have XBee part of my complete embedded solution with STM micro attached to it via a serial port. I can't afford to open XBee when it comes from a factory and connect XCTU or any other board.
Yes, I have checked those files and everything on those files looks correct from space/tab/indentation point of view. I loaded the same files using XCTU for verification and use it from XBee.
I will try to upload the snippet of the code and error if possible by tomorrow.
I have XBee part of my complete embedded solution with STM micro attached to it via a serial port. I can't afford to open XBee when it comes from a factory and connect XCTU or any other board.
Yes, I have checked those files and everything on those files looks correct from space/tab/indentation point of view. I loaded the same files using XCTU for verification and use it from XBee.
I will try to upload the snippet of the code and error if possible by tomorrow.
Re: Sending python file from STM32 to XBEE
if you send the files line by line, did you add a delay after each line? If at the XBEE side uart.readline() is used, it requires some time to process the data.
Re: Sending python file from STM32 to XBEE
Another question: does the stm32 have an interface to the outside world?
Re: Sending python file from STM32 to XBEE
When I send line by line, I have added delay before sending each line. STM32 doesn't have an interface to the outside world. How could have that helped?