• Welcome to Andy's Workshop Forums. Please login or sign up.
 
May 06, 2024, 01:02:11 pm

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.

Messages - mhel

16
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.
17
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.
18
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  :)
19
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 ;-)
20
stm32plus C++ library / Re: passing reference...
November 27, 2015, 09:59:19 am
Well I'm doing it wrong :(

Here's my simple class


template<class TUsart>
class SerialUsartIO {
private:
/* This should not be in here */
//   typedef Usart6InterruptFeature UsartIRQ;
//   Usart6<UsartIRQ> _usart;
TUsart _usart;

CircularBuffer<uint8_t, 128> RxBuffer;
CircularBuffer<uint8_t, 128> TxBuffer;

public:

SerialUsartIO(uint32_t baud) : _usart(baud) { Init(); }

void Init();
void onInterrupt(UsartEventType uet);

void PutChar(uint8_t c);
void PutStr(const char*);
uint8_t GetChar(void);
};

I get undefined reference on all my member function like this,

undefined reference to `SerialUsartIO<stm32plus::Usart6<stm32plus::UsartInterruptFeature<(unsigned char)6> > >::GetChar()

In my main I do this,

typedef Usart6<Usart6InterruptFeature> MyUsart;
SerialUsartIO<MyUsart> console(115200);
ch = console.GetChar();

I just want to be able to have access to some methods in Usart6 that I could also
pass to another class in case I have to.
What would be the correct way of doing it?


EDIT:
I just found out that templated definitions can't go in a separate .cpp file must be in the .h along with the declarations.
Did I mention I'm new to C++ :-)

I also discovered the existense of CircularBufferInputOutputStream and used that instead. It's somewhat working with receive interrupt,
but hangs after a while. I still can't get the transmit interrupt working it hangs as soon as I enabled it. (Feel free to point me in the right direction with this one)

Thanks.
21
stm32plus C++ library / Re: passing reference...
November 26, 2015, 03:28:33 pm
Thanks. That's just what I need. I'll also try to use it with a template.
I'll post back my result later, right now I'm battling with transmit interrupt (recieve works though).

Thanks again.
22
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?
23
stm32plus C++ library / Re: stm32f4disco External RTC
November 12, 2015, 04:50:03 pm
Hi,

I didn't want to open a new thread so I'll post my new query here.

I can't figure out how to keep the time when power is off, even though I have the VBat powered
by coin battery.

I'm simply doing it like this:

    FlagStatus flag;
    flag = RTC_GetFlagStatus(RTC_FLAG_INITS);
    if(flag == RESET){
_rtc.setTime(15, 22, 0);
_rtc.setDate(15, 11, 12, 5);
    }


Is checking INITS bit enough before setting the RTC?

(Note: I'm pretty new to C++, so I'm using the RTC as my learning project)

Edit: It might be hardware problem, as I see VBat dips to 1.2v after I remove power to VDD.
24
stm32plus C++ library / Re: stm32f4disco External RTC
November 06, 2015, 09:23:35 am
It works! I tried the rtc example with the suggested changes.
The orange LED PD13 is now blinking.
I just found out that the Rtc<> is defined in Rtc.h.
I was looking for it for more understanding.

Thanks so much.
--mhel
25
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