Hey,
I've purchased an STM32 ARM CM3 board (just off eBay), and decided I would use ChibiOS to power my quad rotor platform.
I am having trouble getting started with the serial driver. I see the demos use the test code, but I'm finding it hard to get my code working (after getting the simple demo working).
What I am stuck with, is how do I actually write data to the serial port? I see that test.c uses chIOPut() to write data, and writes to a BaseChannel, which uses &SD1 (I changed it from &SD2). When trying to implement this same code, I am unable to get data to send.
I have checked board.h, and am certain I have got the pins right.
Is there a way to use printf or the like?
Cheers,
MM
Trouble getting started
Moderators: RoccoMarco, lbednarz, tfAteba
-
Microman171
- Posts: 16
- Joined: Sun May 29, 2011 2:38 am
Re: Trouble getting started
Here is a link to the main.c file I am using: https://github.com/dancollins/Quad-Roto ... tor/main.c
In that repo, there is all of the code I am using. This includes ChibiOS, and the board files, config files, etc.
In that repo, there is all of the code I am using. This includes ChibiOS, and the board files, config files, etc.
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Trouble getting started
Hi,
I assume the program does not hang so the led continues blinking. I doubt it is a problem with SD1 because there are other STM32 demos that use that port (see the STM32VL-Discovery demo).
The code looks correct, I would verify the board.h clock settings, is the xtal 8MHz? also verify if the board requires specific settings (jumpers) and verify if there are external problems (cable, term program settings 38400-8-N-1 and so on). If in doubt you may look at the TX pin with a scope too.
I suggest that you start from the board files of the ST_STM3210E_EVAL board (present in version 2.3.3) because in STM32 HD devices there are more ports to initialize. In the new board files there are also new macros that should make I/O configuration much easier.
BTW, instead of chIOPut() you may also use sdPutTimeout() or sdWriteTimeout() that are a bit more direct, chIOPut() is only required if you need to write to a generic output channel so it uses one more level of indirection, sdPutTimeout() and sdWriteTimeout() write directly on the serial port.
Giovanni
I assume the program does not hang so the led continues blinking. I doubt it is a problem with SD1 because there are other STM32 demos that use that port (see the STM32VL-Discovery demo).
The code looks correct, I would verify the board.h clock settings, is the xtal 8MHz? also verify if the board requires specific settings (jumpers) and verify if there are external problems (cable, term program settings 38400-8-N-1 and so on). If in doubt you may look at the TX pin with a scope too.
I suggest that you start from the board files of the ST_STM3210E_EVAL board (present in version 2.3.3) because in STM32 HD devices there are more ports to initialize. In the new board files there are also new macros that should make I/O configuration much easier.
BTW, instead of chIOPut() you may also use sdPutTimeout() or sdWriteTimeout() that are a bit more direct, chIOPut() is only required if you need to write to a generic output channel so it uses one more level of indirection, sdPutTimeout() and sdWriteTimeout() write directly on the serial port.
Giovanni
-
Microman171
- Posts: 16
- Joined: Sun May 29, 2011 2:38 am
Re: Trouble getting started
Hey Giovanni,
Perhaps I need to look at the board.h file more carefully. I have modified the OMILEX board file as used by the basic ARM CM3 - GCC demo, and have successfully had data moving. If you can't see any problems with the way I am trying to send data, then I guess it must be the board file.
Thanks for your help, I'll be sure to let you know how I get one
Cheers,
MM
Perhaps I need to look at the board.h file more carefully. I have modified the OMILEX board file as used by the basic ARM CM3 - GCC demo, and have successfully had data moving. If you can't see any problems with the way I am trying to send data, then I guess it must be the board file.
Thanks for your help, I'll be sure to let you know how I get one
Cheers,
MM
-
Microman171
- Posts: 16
- Joined: Sun May 29, 2011 2:38 am
Re: Trouble getting started
Hey,
So I found the problem, and that was not including the board.h file in with the make file. It doesn't explain why the LED still flashed, but I guess there is more to that file than I thought.
I'm happy I have got it all working now
Along the way, I have learned more about ChibiOS. Been a worthwhile experience.
Cheers,
MM
So I found the problem, and that was not including the board.h file in with the make file. It doesn't explain why the LED still flashed, but I guess there is more to that file than I thought.
I'm happy I have got it all working now
Cheers,
MM