• Welcome to Andy's Workshop Forums. Please login or sign up.
 
April 25, 2024, 06:24:31 am

News:

SMF - Just Installed!


Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - mhel

1
stm32plus C++ library / STM32F446
December 04, 2016, 10:16:58 am
Hi,

So I got me a nucleo board with stm32f446RE and I didn't realize
it's not supported by stm32plus yet. How would I go about adding support
for it? stm32plus seems to be using stdperipheral library v1.4 and support for
f446 is only available with the new 1.8.

thanks.
2
stm32plus C++ library / stm32f103C8 & timers
June 10, 2016, 08:14:10 am
Hi All,

So I got this medium density stm32f103 72Mhz, and I managed to get something compiled. I used Debug_f1hd_72_8 build, but changed the memory settings
as mentioned in the readme of stm32++. There's a directory f1md but no build configuration for it, it seems identical to the content of f1hd_72_8

I'm using timer3 and timer4 (both 16bit) which according to the clock tree from the docs is connected to APB1, if I'm not mistaken it should be using 36MHz since the APB1 is divided by 1.
Why is the output of this:
timer3.getClock()
is 72MHz?

I setup my input timer the way I did with stm32f4-discovery board.

            _myInputTimer->initialiseTimeBase(
                    0xFFFF,             // Auto-reload
                    72-1,             // Prescaler
                    0,                  // Division
                    TIM_CounterMode_Up  // Counting up
            );

but no go.

I set it up to output instead and measure (with my newly scrounge oscope).

            outputTimer.initialiseTimeBase(
                    0xFFFF,             // Auto-reload
                    72-1,             // Prescaler
                    0,                  // Division
                    TIM_CounterMode_Up  // Counting up
                    );


Now I'm quite new on using an oscilloscope but the magic button :D that says measure frequency says I'm getting 15Hz

It's more likely that I'm misunderstanding the timer setup hence this post.  What settings should I be looking for?

EDIT1:
So I played with SMT32CubeMX, and found out that with PCLK1 is 36MHz but the Timer clock is 72MHz with x2 multiplier as configured in System.c
Still not sure why on stm32f4 the same setup works as expected, but not on this stm32f103.
3
Hi All,

I'm trying to capture PWM signal from an RC servo receiver  but I'm having a hard time configuring the timer for input.
I change the example to use Timer3 CH1 on Port C6. At the moment I'm just trying to capture 1 channel but will be using 3 onced I get one running.

    typedef Timer3<
        Timer3InternalClockFeature,         // we'll need this for the frequency calculation
//        TimerInternalTriggerClockFeature<TIM_TS_TI1FP1>,
        TimerChannel1Feature<               // we're going to use channel 1
            TimerChannelICBothEdgesFeature,    // both edge trigger
            TimerChannelICDirectTiFeature,    // direct connection
            TimerChannelICPreScaler1Feature,  // prescaler of 1
            TimerChannelICFilterFeature<0>    // no filter
        >,
        Timer3InterruptFeature,           // we want to use interrupts
        Timer3GpioFeature<                // we want to read something from GPIO
          TIMER_REMAP_FULL,               // the GPIO input will be re-mapped
          TIM3_CH1_IN                     // we will read channel 1 from GPIO PC6
        >
      >MyInputTimer;


Some other examples I found suggests that I should set these:

  /* Select the TIM3 Input Trigger: TI1FP1 */
  TIM_SelectInputTrigger(TIM3, TIM_TS_TI1FP1);

  /* Select the slave Mode: Reset Mode */
  TIM_SelectSlaveMode(TIM3, TIM_SlaveMode_Reset);
  TIM_SelectMasterSlaveMode(TIM3, TIM_MasterSlaveMode_Enable);

What am I missing with the timer configuration?
Better yet, if anyone has an example of capturing servo pwm from an RC receiver
it woulbe be greatly appreciated.

edit:
Forgot to mention I'm using the current lib from git.
4
stm32plus C++ library / stm32F102C6
February 12, 2016, 12:20:37 pm
Hi,
How do I add support for stm32F102C6? It's not supported
out of the box. It has 32k flash 6k sram, USB.
I'm going to attempt to convert this http://www.numark.com/product/dj2go to HID
for use with http://mixxx.org/ and learn some USB in the process.
A friend gave it to me after he spilled drinks on it, and
after washing and drying it seems to be functional again.
As it is the controller works as midi device ( I think, that's why the jogwheel is kinda slow to respond ).

I tried openocd with it using the stlink from my F4discovery board:
Open On-Chip Debugger
> poll   
background polling: on
TAP: stm32f1x.cpu (enabled)
stm32f1x.cpu: target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x01000000 pc: 0x080001c0 msp: 0x20000f18
> reset halt
stm32f1x.cpu: target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080001c0 msp: 0x20000f18
> flash probe 0
device id = 0x10006412
STM32 flash size failed, probe inaccurate - assuming 32k flash
flash size = 32kbytes
flash 'stm32f1x' found at 0x08000000


I've already mapped out most of the pins and LEDs except for the buttons.
I probed the buttons and can't identify yet the arrangement, ( it could be 4x4 matrix ).

Diode Common 41 PB5  (16 diodes)
SW1,2,3,4 25 PB12
SW5,6,7,8 26 PB13
SW9,10,11,12 27 PB14
SW13,14,PAD1,2 28 PB15


edit:
This was scrapped, my place burned down last Feb 2016 and lost all, I'm starting again with stm32f4Discovery board.
5
General discussion / Eclipse indexer
December 03, 2015, 02:44:21 pm
Hi,
For anyone not very familiar with Eclipse (like me).

I've been building for stm32f4-discovery board by following Andy's instructions here http://andybrown.me.uk/2015/03/22/stm32dev-windows/
and everything seems ok. The examples builds with my selected configuration (e.g.Debug_f407_168_8).
For some reason whenever I press F3 to follow the declaration it pulls the wrong info (well it's similar info, but wrong file).
When I built stm32plus library, I noticed in project explorer fwlib the f1 directory is active. It confuses me since I'm building
for f4 device and I could program the board and it works. But if I look at some headers that defines the use of F4 device they're inactive.
After some clicking here and there, I found out that you can change the indexer settings.
One can go to Project->Properties->C/C++ General/Indexer of stm32plus library and you can change the Build configuration for indexer and select the
configuration you want to use and you're good to go. It now also fixes all those annoying un-resolve thingies that shouldn't be un-resolve.

I made a post about it so if Mr. Google creeps in here it'll find some usefull info for newbies.
6
stm32plus C++ library / Bug...maybe.
December 01, 2015, 01:53:34 pm
Hi,
I think I may have found a bug in CircularBufferInputOutputStream.
I'm testing it with usart receive interrupt. The buffer seems to get full
even if I'm reading it right away. I'm doing it this way:
In the interrupt routine

d = _usart.receive();
if (!inStream.isFull())
inStream.write(d);

then in my GetChar which I call in main, this what it does:

if (inStream.available()) {
     d = inStream.read();
     _usart.send(d);
}

In

  int16_t CircularBufferInputOutputStream::read() {
    ....
    if(_readPtr >= _buffer + _bufferSize) {
      _readPtr=_buffer;
    _wrappedWrite = false;  /* This seems to be a fix */
    }
    return value;
  }


I add _wrappedWrite = false;

It would be nice to have a confirmation if it's a bug or I'm doing it wrong again  :)
7
General discussion / Eclipse little helper...
November 30, 2015, 05:07:10 pm
Hi,
I just want to share this good find for anyone who might find it useful:
http://embsysregview.sourceforge.net/
It adds registers view in eclipse, only support some microcontrollers though.
Luckily for me stm32f407 of stm32f4discovery board is supported.

EDIT:
Gnu-arm-eclipse already has a similar plugin.
https://gnuarmeclipse.github.io/debug/peripheral-registers/ now I know too ;-)
8
stm32plus C++ library / passing reference...
November 25, 2015, 05:47:46 pm
Hi,
This is likely a throw in the dark. (I can't even think of a proper title for the subject).
I'm trying to use interrupt driven Usart, I'm having a hardtime figuring out how
I can access the interrupt features from another class. I'm using Usart6.
like so:
Usat6<Usart6InterruptFeature> usart6
with usart6 passed as parameter in a constructor. I could point to it using:
Usart& _usart = usart6
but I don't have access to enable/disableInterrupts.
How would one go about it?
9
stm32plus C++ library / stm32f4disco External RTC
November 05, 2015, 04:33:38 pm
Hello newbie here,
First off, thanks to Andy for sharing this very good library.

I'd like to use the LSE for the RTC, I've already installed
the crystal and other necessary hardware modification
that should make it work.
If anyone has a spare time, could you please modify the RTC
example for stm32f4 to use the external clock.
I want to display the time in my hd44780 LCD, I already got
the LCD sorted out. I just need a little nudge with RTC initialization thing.

TIA