2015-12-12 07:29 AM
Hello All,
Moving from the Motorolla 9s12 to the stm32. Just got a eval board and after recovering from Register shock I am just trying to get some blinky lights and serial comm (USART) going which is what I would normally use as my debugger : ) Having a problem getting usart to work. Nothing showing up on my pc via hyperterm. Using the debugger is it possible to see what goes in the USART data register or is that shifted out so quick one would only see 0. ? Thanks and enjoy #usart #debugger-stm322015-12-12 09:50 AM
If you use CDC/VCP of usb to do debugging, you can follow the example I built:
https://bitbucket.org/rwmao/cdc_onstm32f411rc/wiki/Home
It is really simple. Plug in USB to computer, and run a program(attached on above website), chip can send chars to computer.You can check the snapshots. https://bitbucket.org/rwmao/cdc_onstm32f411rc/src/12de104e5bb561881af2c471d97ab3d46b30f6b4?at=masterlet me elaborate a little bit more.USART debug uses comm port to exchange data. You can also use USB as a virtual comm port to exchange data between computer and chip.For most developing board, there are two usb ports, one is for programming (SWD) and another is USB for data,which can be a usb host,device,cdc or others.2015-12-12 12:20 PM
Let's start with with what STM32, on what Board, and try and narrow this down a tad.
The debugger cannot give you a view inside the peripherals. The register you write data to the USART is not the same register as you read back, even if at the same address, or very quickly afterward. Reading the data register so the debugger can show it to you clears/alters bits in the status register. The debugger doesn't have magic access to hardware, and tends to be invasive.2015-12-12 02:02 PM
My board uses the stm32f105rc. I got the board from imagecraft C. the rx,tx lines go thru a
FT230XS usb chip to the pc. When I step thru my code I do get some characters appearing on the terminal but its garbage. I do not have my scope up and running so I cant look at the clock that drives usart 1 but looking at the rcc registers I am running at 72 MHz. Calculated baud is baud=72MHz/57600 . This should not be taking me this long to get to work but up side is making me go thru the documentation and understanding the controller. I will post code if I can not get it talking fairly soon. Thanks for your help.2015-12-12 03:27 PM
The biggest trap here is HSE_VALUE, it should be defined to match the physical oscillator speed so the math to compute the rates works properly. In most STM32 it's generally set for 8 MHz, I suspect a 105/107 board might use 25 MHz
2015-12-12 03:59 PM
Yes, you are correct about that! stm32f10x.h had the hclk defined as 25MHz. I previously changed that define to 8MHz to reflect the part on my board. I may have to try another terminal program or computer to see if that works. Thanks for your help, again.
2015-12-13 01:40 PM
You can try this terminal:
it looks like I am selling software ):. It is free. I used it to debug CDC(USB). it is a good tool to use.2015-12-14 11:31 AM
I moved my development to a different computer and now the program works.
I really hate those type of problems. Ugh...2015-12-15 03:31 AM