M24SR-DISCOVERY

Any other STM32 based boards
Post Reply
lloyd-g
Posts: 9
Joined: Thu Feb 25, 2016 11:40 am

M24SR-DISCOVERY

Post by lloyd-g » Mon Feb 29, 2016 10:01 am

I've got hold of a M24SR-DISCOVERY MB1138 and was wondering if anyone had got them to work on the Arduino STM32 ide?
I use an ST-link to program it.
So far I can get some running code with the IDE set to STM32F103RE under genericSTM32F103R.
The processor is a STM32F103RGT6 which is close to the STM32F103RE. With more memory.

My main problem is finding where Serial comes out?
I can find that Serial4 turns up on pins PC10 and PC11 but there is not a squeak out of the USB.
do I need to enable something in boards.txt or do I need to make a new variant to match my hardware?


http://www.st.com/web/catalog/tools/FM1 ... -discovery

Image

User avatar
mrburnette
Posts: 1829
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: M24SR-DISCOVERY

Post by mrburnette » Mon Feb 29, 2016 1:24 pm

Welcome to the forum.

An obvious place to start is with the board schematic.
STM32_Discovery-USB.jpg
STM32_Discovery-USB.jpg (21.84 KiB) Viewed 1252 times
Here we see that the USB connector has a matching transformer inline, FL1... this may be for common mode rejection, but I have not previously seen this implementation. I suspect it was utilized because many experimenters use inexpensive wall warts with significant switching noise.

The USB section above connects to the microcontroller, thus:
STM32_USB-input.jpg
STM32_USB-input.jpg (3.86 KiB) Viewed 1252 times
A significant number of peripheral devices are hosted on the Discovery board:
hosted.jpg
hosted.jpg (26.75 KiB) Viewed 1252 times
The ST resource page for your device is here.

From the User manual:
3.3 Program and debug the M24SR-Discovery board
In order to flash or debug an STM32 microcontroller application on the M24SR-Discovery
board, simply connect the 20-pin JTAG/SWD flat ribbon of the STLINK/V2 in-circuit
debugger and programmer to the discovery kit board JTAG connector (J2).
Launch STLink Utility PC software. STM32F103RGT6 is part of the STM32F10x XL-density
family.
So, question: Have you replaced the stock firmware with the Maple bootloader? Obviously, this would render all of the existing hardware as floating/uninitialized.

Code: Select all

So far I can get some running code with the IDE set to STM32F103RE under genericSTM32F103R.
Exactly how did you get 'some code' running... that is, how did you program it?

To date: these threads represent the Discovery Boards already investigated.


Ray

lloyd-g
Posts: 9
Joined: Thu Feb 25, 2016 11:40 am

Re: M24SR-DISCOVERY

Post by lloyd-g » Mon Feb 29, 2016 2:22 pm

I used the Arduino STM32 IDE and set the board to genericSTM32F103R then STM32F103RE and to up load via ST-LINK.

Used a version of the AnalogRead.ino but was expecting it to come out of the USB as a CDC device.

I then did a Serial.println for Serial1.println("1"); to Serial5.println("5") and checked all the STM32F103RG serial TX pins PC10 has some useful pins as I don't have Bluetooth fitted.

but Serial.println is nowhere to be seen.

Took out R79 and linked ST1 pins 2 and 3 but still no CDC device was see with lsusb.
All parts are fitted in the USB area.
Image
It may be a software switch somewhere?
I figure if the USB is not working neither will a Maple Bootloader.

I can debug by replacing Serial with Serial4 for all the sketches I use?
I was hoping for USB serial saves me a converter and links.

User avatar
mrburnette
Posts: 1829
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: M24SR-DISCOVERY

Post by mrburnette » Mon Feb 29, 2016 2:27 pm

lloyd-g wrote:I used the Arduino STM32 IDE and set the board to genericSTM32F103R then STM32F103RE and to up load via ST-LINK.
<...>
I figure if the USB is not working neither will a Maple Bootloader.

I can debug by replacing Serial with Serial4 for all the sketches I use?
I was hoping for USB serial saves me a converter and links.
USB sketch upload is controlled by the bootloader.
Sketch "print" USB functionality is managed by libraries linked into the sketch ... the bootloader has no participation in user programs after the sketch is loaded and the bootloader jumps to the C initialization routine.

Ray

lloyd-g
Posts: 9
Joined: Thu Feb 25, 2016 11:40 am

Re: M24SR-DISCOVERY

Post by lloyd-g » Mon Feb 29, 2016 3:43 pm

Got it ray so you agree the USB not working could be a software issue?
Any Idea how I get it to send my println functions to the USB?

Is it an #include some header or a switch in the Boards.txt or something else.

I've had a go at writing USB code in the ST SDK and it was very painful hoped this was better.

zmemw16
Posts: 1449
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: M24SR-DISCOVERY

Post by zmemw16 » Mon Feb 29, 2016 4:38 pm

<edit> just looked it up, Farnell £19; not that bad.
not on aliexpress
ebay single listing £30
</edit>

@Ray i added some terms, thx, btw i've never actually been told i've had a good idea in my life!

'google & rtfm' and so proceed ad infinitum
discovery bootloader site:stm32duino.com
discovery bootloader install site:stm32duino.com
1st is http://www.google.com/url?sa=t&rct=j&q= ... 9255,d.ZWU

oh, that's familiar!
discovery serial bootloader site:stm32duino.com
stephen

User avatar
mrburnette
Posts: 1829
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: M24SR-DISCOVERY

Post by mrburnette » Tue Mar 01, 2016 3:25 am

zmemw16 wrote: <...>
@Ray i added some terms, thx, btw i've never actually been told i've had a good idea in my life!
<...>
@stephen,

The way I utilize the Google "site:<domain>" syntax is to dump broad hits, then I use the browser's "find on page" to narrow down the results set.

Not everyone like to do it that way, but it does provide a mechanism to secure a tight grouping of potential results. So, "discovery site:stm32duino.com" is a shotgun blast and ctrl-f + "M24" would be a rifle shot.

To each their own in how tools are used.

Ray

User avatar
mrburnette
Posts: 1829
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: M24SR-DISCOVERY

Post by mrburnette » Tue Mar 01, 2016 3:35 am

lloyd-g wrote:Got it ray so you agree the USB not working could be a software issue?
Any Idea how I get it to send my println functions to the USB?

Is it an #include some header or a switch in the Boards.txt or something else.

I've had a go at writing USB code in the ST SDK and it was very painful hoped this was better.
lloyd-g,

I agree you cannot use a bootloader to load a sketch if the bootloader loaded does not understand what to do with the protocol. But STMFxxx devices also have a firmware serial bootloader (you would use a USB-serial TTL 3.3V adapter) The topic is covered in many places, but Roger addresses it here:
viewtopic.php?t=66

Or you could, I suspect, use the ST-Link... the Bluetooth may be configurable too. But, I have no experience with the board.

Ray

stevech
Posts: 441
Joined: Thu Aug 27, 2015 6:32 am

Re: M24SR-DISCOVERY

Post by stevech » Tue Mar 01, 2016 8:31 am

Is it well known that most all STM32Fxxx other than the least capable have a nice bootloader in ROM? Supports industry standard DFU which is not the Arduino legacy from 8 bit kind of bootloader.
Quoting ST documentation:
Embedded bootloader
The embedded bootloader mode is used to reprogram the Flash memory using one of the
following serial interfaces:
• USART1 (PA9/PA10)
• USART3 (PB10/11 and PC10/11)
• CAN2 (PB5/13)
USB OTG FS (PA11/12) in Device mode (DFU: device firmware upgrade).

lloyd-g
Posts: 9
Joined: Thu Feb 25, 2016 11:40 am

Re: M24SR-DISCOVERY

Post by lloyd-g » Tue Mar 01, 2016 10:23 am

Back to original question.
If I run a sketch like Arduino_STM32/examples/Maple/StressSerialUSB/StressSerialUSB.ino
How do I get it to run and give USB output on my board?
Not at present interested in bootloaders just want USB serial.
Have programing worked out. (ST-LINK)
With USB_Disconnect tied low, so USB device is detected by windows and Ubuntu.
They get no ID packet, so USB module in STM32 is not initializing.

Loaded an example for libopencm3 and I get USB output so not hardware. Working libopencm3 USB is not easy!

Where is USB serial initialized in code as it is not apparent.

Found -DSERIAL_USB in Arduino_STM32/STM32F1/boards.txt but if added to STM32F103RE device_variant.

Still not working is something else missing?
Sections from Arduino_STM32/STM32F1/boards.txt

Code: Select all

########################### Generic STM32F103R ###########################

genericSTM32F103R.name=Generic STM32F103R series
#genericSTM32F103R.build.variant=generic_stm32f103r
genericSTM32F103R.build.vect=VECT_TAB_ADDR=0x8000000
genericSTM32F103R.build.core=maple
genericSTM32F103R.build.board=GENERIC_STM32F103R
genericSTM32F103R.upload.use_1200bps_touch=false
genericSTM32F103R.upload.file_type=bin
genericSTM32F103R.upload.auto_reset=true
 

genericSTM32F103R.menu.device_variant.STM32F103RE=STM32F103RE (64k RAM. 512k Flash)
genericSTM32F103R.menu.device_variant.STM32F103RE.build.variant=generic_stm32f103r
genericSTM32F103R.menu.device_variant.STM32F103RE.build.cpu_flags=-DMCU_STM32F103RE  -DSERIAL_USB 
genericSTM32F103R.menu.device_variant.STM32F103RE.upload.maximum_size=524288
genericSTM32F103R.menu.device_variant.STM32F103RE.upload.ram.maximum_size=65536
genericSTM32F103R.menu.device_variant.STM32F103RE.upload.flash.maximum_size=524288
genericSTM32F103R.menu.device_variant.STM32F103RE.build.ldscript=ld/stm32f103re.ld

#---------------------------- UPLOAD METHODS ---------------------------

genericSTM32F103R.menu.upload_method.STLinkMethod=STLink
genericSTM32F103R.menu.upload_method.STLinkMethod.upload.protocol=STLink
genericSTM32F103R.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
genericSTM32F103R.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB -DGENERIC_BOOTLOADER
 
 
Looked at code in
Arduino_STM32/STM32F1/variants/generic_stm32f103r/
Can't see any switches there when compared to Maple?

Post Reply