ChibiStudio Terminal Debug

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

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
kb1gtt
Posts: 41
Joined: Sat Jul 09, 2016 11:29 am
Has thanked: 11 times
Been thanked: 2 times

ChibiStudio Terminal Debug

Post by kb1gtt »

I'm using a STM32F429 discovery board. I was having problems, but now it's resolved. This is mostly a trail of bread crumb for others or myself to potentially find.

I started with this tutorial and below I have filled in several blanks. http://www.playembedded.org/blog/en/201 ... o-chibios/

Here are my notes about how I got messages to show up in ChibiStudio's terminal being sent from the STM32F429 discovery board.

From ch.h, other versions may work, this is the version I was on when I did this.

Code: Select all

#define CH_KERNEL_MAJOR         3
#define CH_KERNEL_MINOR         0
#define CH_KERNEL_PATCH         1

I do no know how to verify the uGFX version. If I knew how I would post it here as I know this version works with that chibios version.

In mcuconf.h I have this

Code: Select all

#define STM32_SERIAL_USE_USART1             TRUE
blah
#define STM32_UART_USE_USART1               FALSE

In halconf.h I have

Code: Select all

#define HAL_USE_SERIAL              TRUE
blah
#define HAL_USE_SERIAL_USB          FALSE
blah
#define SERIAL_DEFAULT_BITRATE      38400

In os_chibios_3.mk I have

Code: Select all

# Add include files
INCPATH +=  blah
            $(CHIBIOS)/os/hal/lib/streams/ \
            $(CHIBIOS)/os/various

# Add C files
SRC  += blah
        $(CHIBIOS)/os/hal/lib/streams/memstreams.c \
        $(CHIBIOS)/os/hal/lib/streams/chprintf.c

And finally in main.c I have

Code: Select all

#include "gfx.h"
#include "ch.h"
#include "hal.h"
#include "chprintf.h"
#include "memstreams.h"
BaseSequentialStream* chp = (BaseSequentialStream*) &SD1; // for serial debugger chprintf statements.

blah

/*
 * Red LED blinker thread, times are in milliseconds.
 */
static THD_WORKING_AREA(waThread1, 512);
static THD_FUNCTION(Thread1, arg) {

  (void)arg;
  chRegSetThreadName("heart_beat");
  while (true) {
    palClearPad(GPIOG, GPIOG_LED4_RED);
    chThdSleepMilliseconds(500);
    palSetPad(GPIOG, GPIOG_LED4_RED);
    chThdSleepMilliseconds(500);
    chprintf(chp, "Hello world\n\r");
  }
}

int main(void) {
  sdStart(&SD1, NULL); // Start serial, this will allow chprintf statements to work.
  chThdCreateStatic(waThread1, sizeof(waThread1),//Create heart beat thread
                  NORMALPRIO + 9, Thread1, NULL);
blah

This done with ChibiStudio on a win7 64 bit. I have STLink installed and under device manager --> Ports, I see I have STLink Virtual COM port (COM8).

The hardware is an STM32F429 discovery board. From visual inspection I see the factory setting is with a solder blob jumper on SB15 and SB11 is open. I see from the schematic (snippet below), that we are dealing with PA10, then table 10 of en.DM00071990.pdf indicates we are USART1. So I set the UART in the mcuconf.h and halconf.h files to 1.
Capture.PNG
Capture.PNG (15 KiB) Viewed 3205 times

When this is all done, I get this in ChibiStudio, notice the Hello World showing up once very second, in sync with the red LED.
Capture.PNG
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: ChibiStudio Terminal Debug

Post by Giovanni »

Hi,

Good job, the first step is the hardest.

Giovanni
kb1gtt
Posts: 41
Joined: Sat Jul 09, 2016 11:29 am
Has thanked: 11 times
Been thanked: 2 times

Re: ChibiStudio Terminal Debug

Post by kb1gtt »

These first steps are both hard and very critical. Getting them right and knowing how they interact is very important for the coding to come.

Thanks for the great OS and efforts. I'm sure those first steps were even harder than my trivial first steps.
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: ChibiStudio Terminal Debug

Post by RoccoMarco »

I have to add a note into the article about the magic button :mrgreen:
Post Reply