"chprintf" , STM32F303 Discovery Topic is solved

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess

bennydeber
Posts: 5
Joined: Thu Jul 20, 2017 6:25 pm
Has thanked: 1 time
Been thanked: 1 time

"chprintf" , STM32F303 Discovery

Postby bennydeber » Wed Jul 26, 2017 3:19 pm

Hi,
I 'm using a STM32F303 Discovery Board and I have done a project that works, but I would like to use chprintf and read the datas on terminal:

Code: Select all

for (i=0;i<=8;i++){
       percentage = 500+i*1000;

   chprintf(chp, "PERCENTAGE -> %d\n\r",percentage/100);
        chThdSleepMilliseconds(1000);

                     }


I have included "chprintf.h",the port is correct and I use STLink V2 to print data on the terminal. I have to change something in the makefile?


Thank you all.

PS.
I have also tried this project (http://www.playembedded.org/blog/en/201 ... -and-mems/) and the demo "USB_CDC", but both give me a lot of errors. As playembedded suggests, I connect the board through the User USB: at first my PC didn't recognize the device, after installing STM32 Virtual COM Port Driver, it seems to recognize it.

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: "chprintf" , STM32F303 Discovery

Postby Giovanni » Wed Jul 26, 2017 5:14 pm

Hi,

chprintf() must also be included in the makefile togethr with memstream.c, see any demo that uses it.

Giovanni

User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: "chprintf" , STM32F303 Discovery

Postby RoccoMarco » Wed Jul 26, 2017 5:26 pm

Hi,
which version of ChibiOS are you using?
Ciao,
RM

bennydeber
Posts: 5
Joined: Thu Jul 20, 2017 6:25 pm
Has thanked: 1 time
Been thanked: 1 time

Re: "chprintf" , STM32F303 Discovery

Postby bennydeber » Wed Jul 26, 2017 5:31 pm

Giovanni wrote:Hi,

chprintf() must also be included in the makefile togethr with memstream.c, see any demo that uses it.

Giovanni


I have modified my makefile , but the situation doesn't change:

Code: Select all

CSRC = $(STARTUPSRC) \
       $(KERNSRC) \
       $(PORTSRC) \
       $(OSALSRC) \
       $(HALSRC) \
       $(PLATFORMSRC) \
       $(BOARDSRC) \
       $(TESTSRC) \
       $(CHIBIOS)/os/hal/lib/streams/memstreams.c \
       $(CHIBIOS)/os/hal/lib/streams/chprintf.c \
       main.c




RoccoMarco wrote:Hi,
which version of ChibiOS are you using?


the version is 17.7.

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: "chprintf" , STM32F303 Discovery

Postby steved » Wed Jul 26, 2017 5:38 pm

There are three places in the makefile which need updating:
1. The list of included make files
2. The list of source files (which you have done)
3. The list of 'include' directories

If you are using 17.1.6, they are:

Code: Select all

1. include $(CHIBIOS)/os/hal/lib/streams/streams.mk
2.        $(STREAMSSRC) \         # Adds all needed source files
3. $(STREAMSINC)

Earlier versions have similar requirements, but they may be expressed differently

User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Location: Munich (Germany)
Has thanked: 83 times
Been thanked: 67 times
Contact:

Re: "chprintf" , STM32F303 Discovery

Postby RoccoMarco » Wed Jul 26, 2017 5:40 pm

The article has been written for 161, and inclusion was performed in a different way (as Steved said).

An error in demo from playembedded... ok it is possible. An error in USB-CDC demo is quite strange.

Can you post here the error you are receiving with USB_CDC? I will give a little try to the playembedded demo meanwhile.
Ciao,
RM

bennydeber
Posts: 5
Joined: Thu Jul 20, 2017 6:25 pm
Has thanked: 1 time
Been thanked: 1 time

Re: "chprintf" , STM32F303 Discovery

Postby bennydeber » Wed Jul 26, 2017 5:57 pm

RoccoMarco wrote:The article has been written for 161, and inclusion was performed in a different way (as Steved said).

An error in demo from playembedded... ok it is possible. An error in USB-CDC demo is quite strange.

Can you post here the error you are receiving with USB_CDC? I will give a little try to the playembedded demo meanwhile.



Sorry, I was wrong. USB_CDC starts, but the terminal is like this:

Image

bennydeber
Posts: 5
Joined: Thu Jul 20, 2017 6:25 pm
Has thanked: 1 time
Been thanked: 1 time

Re: "chprintf" , STM32F303 Discovery-RESOLVED  Topic is solved

Postby bennydeber » Thu Jul 27, 2017 3:10 pm

Ok, USB_CDC works now:

I downloaded the latest version of ST-Link Utility and I did the firmware upgrade.
Now when I connect my board through USB USER and USB ST-LINK in device manager there are two COMs:
Image.

The next steps are disconnect USB USER, run OpenOCD on ST-Link V2 and flash, play and select "COM7" as port in terminal settings.
After this, I connect the second USB (in this way both usb are connected to my pc) and after I press Enter button.
Now I can choose one of the command (for example "help","exit" and so on...) and so I can see the output on the terminal :)


Return to “General Support”

Who is online

Users browsing this forum: No registered users and 63 guests