Page 2 of 2

Re: Example code for STM32F4 Discovery

Posted: Thu Jul 26, 2012 11:57 am
by gentijo
I totally missed the USB-CDC in testhal.. To answer your question, yes I can compile and run that code just fine which is what I was looking for..
I still get the linker with your Github project, the only differences I found in the Makefile's were
USE_FPU = no
the include $(CHIBIOS)/test/test.mk is not commented out
and in CSRC there is a ref to $(TESTSRC) \

none made a difference.

Thank you for pointing out the other project.

-John Gentilin

Re: Example code for STM32F4 Discovery

Posted: Thu Jul 26, 2012 8:47 pm
by jscott
I made a change to the "threads" command. I added the thread name to the display.
Now if you set the thread name it will show up correctly in the list.

Here is the updated function:

Code: Select all

void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) 
{
   static const char *states[] = {THD_STATE_NAMES};
   Thread *tp;

   (void)argv;
   if (argc > 0)
   {
      chprintf(chp, "Usage: threads\r\n");
      return;
   }
   chprintf(chp, "%10s %10s %10s %6s %6s %11s %7s\r\n",
            "name", "add", "stack", "prio", "refs", "state", "time");
   tp = chRegFirstThread();
   do
   {
      chprintf(chp, "%10s %.10lx %.10lx %6lu %6lu %11s %7lu\r\n",
               (uint32_t)tp->p_name, (uint32_t)tp, (uint32_t)tp->p_ctx.r13,
               (uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1),
               states[tp->p_state], (uint32_t)tp->p_time);
      tp = chRegNextThread(tp);
   } while (tp != NULL);
}


If you find any problems, please let me know.
-John

Re: Example code for STM32F4 Discovery

Posted: Thu Jul 26, 2012 8:58 pm
by Giovanni
The thread name could be NULL if not set, you should consider that case.

Giovanni

Re: Example code for STM32F4 Discovery

Posted: Sat Jul 28, 2012 11:02 pm
by jscott
In the updated "threads" command function, I tested for the case of Process Name p_name being null.

The displays "(Null)" in that column.

If anyone gets an error, please try to give me some details.

-John

Re: Example code for STM32F4 Discovery

Posted: Mon Sep 03, 2012 9:47 pm
by awilkinson
Thanks for all your hardwork and generosity! I've had a couple of goes at compiling this using Yagarto on WinXP SP3 and Summon on Debian. In both cases I get:
../ChibiOS/os/hal/platforms/STM32F4xx/hal_lld.h:775:2: error: #error "Using a wrong mcuconf.h file, STM32F4xx_MCUCONF not def
../ChibiOS/os/hal/platforms/STM32/OTGv1/usb_lld.h:152:2: error: #error "USB driver activated but no USB peripheral assigned"

Please would you be kind enough to advise on what I'm doing wrong? I apologise for my ignorance and stupidity.

DDEFS = -DSTM32F4xx_MCUCONF -DSTM32_USB_USE_OTG1

in the Makefile got me a little further but then I got:

myUSB.c:152:3: error: extra brace group at end of initializer
myUSB.c:152:3: error: (near initialization for 'serusbcfg')

Re: Example code for STM32F4 Discovery

Posted: Tue Sep 04, 2012 7:57 am
by Giovanni
Hi,

The newer version in the repository checks that the mcuconf.h file into the application directory is the right one for the selected architecture. Probably your mcuconf.h file is from an older version, you have to update it by taking one from one of the included demos for the STM32F4.

The second error is fixed by enabling the USB support in the mcuconf.h, previously it was enabled by default, now it is disabled.

Giovanni

Re: Example code for STM32F4 Discovery

Posted: Sun Sep 30, 2012 10:00 am
by dancios
Giovanni wrote:The second error is fixed by enabling the USB support in the mcuconf.h, previously it was enabled by default, now it is disabled.


How or where the documentation is ?

Re: Example code for STM32F4 Discovery

Posted: Sun Sep 30, 2012 11:25 am
by Giovanni
Hi,

You request is a bit generic, the documentation is here: http://www.chibios.org/dokuwiki/doku.ph ... :documents

Giovanni

Re: Example code for STM32F4 Discovery

Posted: Fri Dec 21, 2012 12:24 am
by resset
Hi,

I made a tiny rework of this project. Now it works on current unstable ChibiOS/RT 2.5.2. I also included a change in cmd_threads from this topic.

Git repository: https://github.com/resset/STM32F4-Discovery-example-code

Thanks for this project, Mathias :)
And (first and foremost!) thanks for ChibiOS, Giovanni :) My first post here ;)

Mateusz

Re: Example code for STM32F4 Discovery

Posted: Fri Dec 21, 2012 8:45 am
by Giovanni
Hi,

Thanks for sharing :)

Giovanni