-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CDC get and set line coding, some machines will refuse to connect to …
…the COM port without this.
- Loading branch information
Showing
1 changed file
with
19 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4cf6591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you use tempbuf[] ?
it is local (automatic) variable in stack, and not save data between calls this function/
4cf6591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, it turns out that it is enough for the data to be just all 0 anyway... Thanks for pointing out the mistake, I didn't spot it as it worked and I didn't revisit :-)
In later versions of Tracealyzer this may not be required anyway.
4cf6591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! It is work!
I use "static uint8_t tempbuf[7] = {0,0,0,0,0,0,0};"
4cf6591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, help me a lot.
4cf6591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also helped me out. Thank you!
4cf6591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I keep getting unexpected or unqualified-id before 'switch' .
My original issue is that I could not upload a simple 'blink' file to confirm operation of an STM32 blue pill. Stating that it could not read port -s, which is the serial port. I am assuming that comments above are related to the serial issue.
4cf6591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what the issue is there, a quick search suggests a number of things... the switch statement being outside of a function for example, It depends on your project really.
4cf6591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Ant,
Thanks for getting in touch!
Yeh the switch statement was out, so that caused the initial issue, the error was on me.
Now its purely down to an error of not being able to read port -s. Which I believe is the serial port, but I have had a search around with no real answer as to how this is caused or how to solve it,
4cf6591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the board enumerating on USB? Check device manager if using windows, it should appear under ports shortly after plugging in.
I'm not familiar with the board you are using, I'd suggest looking through some of ST's USB examples and documentation... it could be one of many things, as an example you will have to make sure you are utilising the external crystal as the internal clocking arrangement of most STM32 is not sufficiently accurate for USB to function properly.
Maybe this will explain a little:
https://www.youtube.com/watch?v=YZjnCOun1wU&vl=en
4cf6591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4cf6591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. It really helped.
4cf6591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I know this is a long time ago, and anyone here has moved on already, but if you're reading this looking for a solution to your Windows SetCommState error, please don't do what's suggested above.
Do this instead.
Declare your line encoding. If you're only using HS or FS, then you only need one.
Then, handle the GET and SET appropriately in the CDC_Control_HS/FS functions like this: