Why is the USB_VCP module gone?
Why is the USB_VCP module gone?
Hello,
After I flashed in latest micropython, I can not find the USB_VCP module which is mentioned in documentation.
While repl_uart module seems like the substitution. Then I tried
>>>vcp = repl_uart()
>>>vcp.send(1, timeout=500)
But it prompted me "AttributeError: 'NoneType' object has no attribute 'send' "
All example codes that I can find lack info. regarding this USB_VCP/repl_uart.
Can anybody help me on this? Thanks.
After I flashed in latest micropython, I can not find the USB_VCP module which is mentioned in documentation.
While repl_uart module seems like the substitution. Then I tried
>>>vcp = repl_uart()
>>>vcp.send(1, timeout=500)
But it prompted me "AttributeError: 'NoneType' object has no attribute 'send' "
All example codes that I can find lack info. regarding this USB_VCP/repl_uart.
Can anybody help me on this? Thanks.
Re: Why is the USB_VCP module gone?
USB_VCP is documented here: http://micropython.org/doc/module/pyb/USB_VCP
Here is an exmple that uses it: https://github.com/dhylands/upy-example ... er/keys.py and here's how you use repl_uart: https://github.com/dhylands/upy-example ... er/boot.py (look at the init function). Running repl_uart with no args returns whatever was previously set or None if it hsasn't been set yet.
Here is an exmple that uses it: https://github.com/dhylands/upy-example ... er/keys.py and here's how you use repl_uart: https://github.com/dhylands/upy-example ... er/boot.py (look at the init function). Running repl_uart with no args returns whatever was previously set or None if it hsasn't been set yet.
Re: Why is the USB_VCP module gone?
What repl_uart does is cause the REPL to be sent to a UART, in addition to having it on the USB serial. By default the repl only goes to the usb. repl_uart() returns None in this case, which is why you got the error you did.
Re: Why is the USB_VCP module gone?
The question is USB_VCP does not exist in lastest micropython build any more. It's gone. How can I find it back?dhylands wrote:USB_VCP is documented here: http://micropython.org/doc/module/pyb/USB_VCP
Here is an exmple that uses it: https://github.com/dhylands/upy-example ... er/keys.py and here's how you use repl_uart: https://github.com/dhylands/upy-example ... er/boot.py (look at the init function). Running repl_uart with no args returns whatever was previously set or None if it hsasn't been set yet.
Re: Why is the USB_VCP module gone?
Sure it is. I just built the latest, flashed it and this is what I see:bittware wrote:The question is USB_VCP does not exist in lastest micropython build any more. It's gone. How can I find it back?dhylands wrote:USB_VCP is documented here: http://micropython.org/doc/module/pyb/USB_VCP
Here is an exmple that uses it: https://github.com/dhylands/upy-example ... er/keys.py and here's how you use repl_uart: https://github.com/dhylands/upy-example ... er/boot.py (look at the init function). Running repl_uart with no args returns whatever was previously set or None if it hsasn't been set yet.
Code: Select all
Micro Python v1.3.1-75-g8369559 on 2014-09-13; PYBv1.0 with STM32F405RG
Type "help()" for more information.
>>> 'USB_VCP' in dir(pyb)
True
>>> pyb.USB_VCP
<class 'USB_VCP'>
>>> u = pyb.USB_VCP()
>>> u.send('Test\r\n')
Test
6
Code: Select all
import pyb
Re: Why is the USB_VCP module gone?
Hi, dhylandsdhylands wrote:Sure it is. I just built the latest, flashed it and this is what I see:bittware wrote:The question is USB_VCP does not exist in lastest micropython build any more. It's gone. How can I find it back?dhylands wrote:USB_VCP is documented here: http://micropython.org/doc/module/pyb/USB_VCP
Here is an exmple that uses it: https://github.com/dhylands/upy-example ... er/keys.py and here's how you use repl_uart: https://github.com/dhylands/upy-example ... er/boot.py (look at the init function). Running repl_uart with no args returns whatever was previously set or None if it hsasn't been set yet.USB_VCP is in the pyb module, and normally boot.py has an import pyb statement in it, so pyb is already imported in your REPL. If, for some reason your boot.py doesn't have an import pyb statement, then you'll need to doCode: Select all
Micro Python v1.3.1-75-g8369559 on 2014-09-13; PYBv1.0 with STM32F405RG Type "help()" for more information. >>> 'USB_VCP' in dir(pyb) True >>> pyb.USB_VCP <class 'USB_VCP'> >>> u = pyb.USB_VCP() >>> u.send('Test\r\n') Test 6
from the REPL before pyb.USB_VCP() will work.Code: Select all
import pyb
Thanks for the timely feedback.
See the attached picture for what I got. There is no USB_VCP within pyb and sys modules.
I might flash the wrong version of mircopython. Then how could I read out mircopython version running on my chip?
- Attachments
-
- 2014-09-14 11_34_14-COM3 - PuTTY.png (37.26 KiB) Viewed 9804 times
Re: Why is the USB_VCP module gone?
Hi dhylands,dhylands wrote:Sure it is. I just built the latest, flashed it and this is what I see:bittware wrote:The question is USB_VCP does not exist in lastest micropython build any more. It's gone. How can I find it back?dhylands wrote:USB_VCP is documented here: http://micropython.org/doc/module/pyb/USB_VCP
Here is an exmple that uses it: https://github.com/dhylands/upy-example ... er/keys.py and here's how you use repl_uart: https://github.com/dhylands/upy-example ... er/boot.py (look at the init function). Running repl_uart with no args returns whatever was previously set or None if it hsasn't been set yet.USB_VCP is in the pyb module, and normally boot.py has an import pyb statement in it, so pyb is already imported in your REPL. If, for some reason your boot.py doesn't have an import pyb statement, then you'll need to doCode: Select all
Micro Python v1.3.1-75-g8369559 on 2014-09-13; PYBv1.0 with STM32F405RG Type "help()" for more information. >>> 'USB_VCP' in dir(pyb) True >>> pyb.USB_VCP <class 'USB_VCP'> >>> u = pyb.USB_VCP() >>> u.send('Test\r\n') Test 6
from the REPL before pyb.USB_VCP() will work.Code: Select all
import pyb
I just commented out all codes in main.py. I saw the first prompt containing the micropython version info. as captured in the attached picture.
It is version 1.2-15-g951ed9d on 2014-07-20.
At least in this version, the USB_VCP does not exist.
It also seems I might have flashed the wrong file two days agao.
- Attachments
-
- 2014-09-14 11_44_20-COM3 - PuTTY.png (34.25 KiB) Viewed 9804 times
Re: Why is the USB_VCP module gone?
Hi, dhylandsdhylands wrote:Sure it is. I just built the latest, flashed it and this is what I see:bittware wrote:The question is USB_VCP does not exist in lastest micropython build any more. It's gone. How can I find it back?dhylands wrote:USB_VCP is documented here: http://micropython.org/doc/module/pyb/USB_VCP
Here is an exmple that uses it: https://github.com/dhylands/upy-example ... er/keys.py and here's how you use repl_uart: https://github.com/dhylands/upy-example ... er/boot.py (look at the init function). Running repl_uart with no args returns whatever was previously set or None if it hsasn't been set yet.USB_VCP is in the pyb module, and normally boot.py has an import pyb statement in it, so pyb is already imported in your REPL. If, for some reason your boot.py doesn't have an import pyb statement, then you'll need to doCode: Select all
Micro Python v1.3.1-75-g8369559 on 2014-09-13; PYBv1.0 with STM32F405RG Type "help()" for more information. >>> 'USB_VCP' in dir(pyb) True >>> pyb.USB_VCP <class 'USB_VCP'> >>> u = pyb.USB_VCP() >>> u.send('Test\r\n') Test 6
from the REPL before pyb.USB_VCP() will work.Code: Select all
import pyb
I just tried the latest version. It works. Thanks for the help.
But one more thing, is there any way that USB_VCP baud rate could be customized just like what UART does?
Thanks again.
Re: Why is the USB_VCP module gone?
USB_VCP has no concept of baud rate. It isn't needed.
When you connect to usb_serial, the baud rate that you use is ignored. You only need a baud rate with a UART.
When you connect to usb_serial, the baud rate that you use is ignored. You only need a baud rate with a UART.
Re: Why is the USB_VCP module gone?
I know REPL needs baud rate of 115200 which is fixed by design.dhylands wrote:USB_VCP has no concept of baud rate. It isn't needed.
When you connect to usb_serial, the baud rate that you use is ignored. You only need a baud rate with a UART.
However, once I need USB_VCP for other purpose, e.g. customized data transmission, then I need to lower this baud rate in order to interface the communication software running on PC. This software communication does not support baud rate of 115200.