[ell-i-developers] Re: Serial on stm32f334nucleo

  • From: Pekka Nikander <pekka.nikander@xxxxxx>
  • To: ell-i-developers@xxxxxxxxxxxxx
  • Date: Thu, 18 Sep 2014 12:58:09 +0300

I would prefer the peripheral to be fully initialised without a call to begin().

That would make debugging easier, as it would allow debugging stuff to call 
Serial.write() without worrying if Serial.begin had been called.

--Pekka

On 2014–09–18, at 12:25 , Ivan Raul <supra.material@xxxxxxxxx> wrote:

> Hi,
> 
> The baudrate is set during the begin method:
> https://github.com/Ell-i/Runtime/blob/master/stm32/cores/arduelli/Arduino_Serial.h#L64
> 
> So, in fact, we rewrite the register each time the serial is initialised.
> (it would be possible to remove this baudrate setting from the initialisation 
> registers)
> 
> However, if the system clock was a constant, this calculation, and the 
> division involved, 
> would be done at compile time. But for safety reasons STM always make runtime 
> calculations.
> as they consider the possibility of clocks failing to initialise.
> 
> 
> With Warm Regards, Ivan Raul
> 
> On Thu, Sep 18, 2014 at 8:22 AM, Pekka Nikander <pekka.nikander@xxxxxx> wrote:
> The code looks good to me, though I'm wondering where the correct baud rate 
> comes from.
> 
> Anyway, could someone please verify this independently?  With a test report 
> I'm willing to merge.
> 
> --Pekka
> 
> 
> On 2014–09–17, at 22:31 , Ivan Raul <supra.material@xxxxxxxxx> wrote:
> 
> > Hi to all,
> >
> > I was wondering if it is possible to receive serial communication through 
> > the stlink bridge of the nucleo. In fact, is possible, and I already 
> > provided a pull request for the change. I hope it helps a little for the 
> > testing of the new PoElli in the next weeks.
> >
> > Please, test accordingly :)
> >
> > mkdir temp
> > cd temp
> > git clone https://github.com/supramaterial/Runtime.git
> > cd Runtime/stm32/build/
> > make sketch.cpp
> >
> > #then, for testing, modify the sketch.cpp to something like this:
> > ##---------------------------
> >
> > #include <Arduino.h>
> >
> > void setup() {
> >     Serial.begin(57600);
> > }
> >
> > void loop() {
> >
> >     Serial.write('H');
> >     Serial.write('e');
> >     Serial.write('l');
> >     Serial.write('l');
> >     Serial.write('o');
> >     Serial.write('\r');
> >     Serial.write('\n');
> >
> >     for (volatile int i = 0; i < 100000; i++)
> >         ;
> >
> > }
> >
> > ##------------------------
> >
> > #then
> > make VARIANT=stm32f334nucleo
> >
> > #and flash
> > sudo st-flash write hardware/stm32f334nucleo/sketch.bin 0x8000000
> >
> > #the good part is that the stlink controller provides the USART2 through
> > #the usb, in linux it shows as /dev/ttyACM0
> >
> > #now, to test, use a serial console, minicom, for example
> >
> > #if minicom not installed
> > sudo apt-get install minicom
> > sudo minicom -s
> > #go to "serial port setup"
> > #configure in this way
> >
> > +------------------------------------------
> > | A -    Serial Device      : /dev/ttyACM0
> > | B - Lockfile Location     : /var/lock
> > | C -   Callin Program      :
> > | D -  Callout Program      :
> > | E -    Bps/Par/Bits       : 57600 8N1
> > | F - Hardware Flow Control : No
> > | G - Software Flow Control : No
> > |
> > |    Change which setting?
> > +------------------------------------------
> >
> > #then "save setup as dfl"
> >
> > #and run minicom
> > sudo minicom
> >
> > #it should show "hello" iteratively
> >
> > With Warm Regards, Ivan Raul
> 
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Other related posts: