python - STM32F4 USB CDC, can't use Data with pyserial -


i have problem combination of stm32f4 usb cdc , pyserial. if code in stm32 wants work received data in main.c can't open port. if not, can send , receive no problem, information stored in userrxbufferfs.

i following error:

>>> ser.open() traceback (most recent call last):   file "<stdin>", line 1, in <module>   file "c:\program files\anaconda2\lib\site-packages\serial\serialwin32.py", line 78, in open     self._reconfigure_port()   file "c:\program files\anaconda2\lib\site-packages\serial\serialwin32.py", line 222, in _reconfigure_port     'original message: {!r}'.format(ctypes.winerror())) serial.serialutil.serialexception: cannot configure port, went wrong. original message: windowserror(87, 'falscher parameter.') 

i tried store data in global variable declared in usbd_cdc_if.h:

usbd_cdc_if.h: extern int my_buf[8];
usbd_cdc_if.c: my_buf[0]=userrxbufferfs[0];

--> error

tried call function in callback brings information main.c --> error

tried global pointer points buffer --> error

all of working when use windows terminal. need use pyserial. when don't work data can connect, send , receive no problem.

has idea of problem , way solve it?

windowserror(87, 'falscher parameter.')

i suppose know means 'wrong parameter'. did send invalid parameter routine?

note that, probably, userrxbufferfs defined unsigned char (1 byte long) because communication byte byte. defining buffer int, either 2 or 4 bytes long.

maybe passing int transmission or initializing routine, routine expects bytes? (or unsigned chars)

my_buf[0]=userrxbufferfs[0]; 

transfers first element userrxbufferfs my_buf, copies unsigned char int, can give unexpected results.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -