PreenFM Forum

PreenFM => preenfm2 and preenfm3 => Topic started by: norbim1 on June 26, 2014, 11:10:19 AM

Title: Stm32F4Discovery port
Post by: norbim1 on June 26, 2014, 11:10:19 AM
Hi,

First of all thank you Xavier for this wonderful project and making it open source.

I've started to port the project to the STM32F4Discovery board, which has a nice audio codec on board. I haven't built the control surface yet, but in the current state I'm able to play notes from USB midi. The board have enough free IO pins left to direct connect the CS buttons and enc-s, so I'll try to eliminate the cs s/p converters too.
To use the onboard I2S audio codec I changed the Systic interrupt to DMA int. Currently I'm using 32 samples long DMA buffer, and it works perfectly. In that way the DMA int is fired only at every 16th sample.
I'm wondering if I can use the full 24 bit resolution of the codec. As far as I see the sample block contains 18 bit normalized uint samples, but I couldn't find where it is normalized. I plan to change the timbre summing at the end of the buildNewSampleBlock(), but I'm sure that it has a better place for it.
Would You mind helping me with the place of the "float to 18 bit" normalizing?

Thank's a lot,
Norbert
Title: Re: Stm32F4Discovery port
Post by: pld on June 26, 2014, 02:32:15 PM
Cool, I've been meaning to look into the DMA/i2s stuff myself :)

IIRC, the way things are calculated is
- the voice calculations produce float values (-1,1) and these are summed per timbre
- Timbre::fxAfterBlock scales the the timbre output from (-n,n) to (-131072,131072) via ratioTimbres and numberOfVoiceInverse to avoid clipping in the final mix
- during the final mixing of the timbre samples in buildNewSampleBlock, the sum is offset from float (-131072,131072) to int (0,2^18) for the DAC

So I guess you mainly have to replace the 131072.f (2^17) constants with 8388609.f (2^23).

Does the codec accept padded 24bit samples (i.e. 32bit), or how does that work with DMA?
Title: Re: Stm32F4Discovery port
Post by: norbim1 on June 26, 2014, 02:59:22 PM
Thanks for the info. I found the offset, but didn't found the scale. I'll try it today evening.

Yes, the codec accepts padded 32 bit samples, the 24 bit part has to be justified to the right. Actually the codec accepts 2*16bit words for one stereo side sample, so I need to swap the half words of the 32 bit int when filling the DMA buffer.
Title: Re: Stm32F4Discovery port
Post by: norbim1 on June 27, 2014, 09:50:13 AM
It works! Thanks again for the info.
Title: Re: Stm32F4Discovery port
Post by: Xavier on June 27, 2014, 11:08:25 AM


Great project  :)
I'm glad to see open source code is usefull to others.
Did you fork the github project ? Don't forget to share your changes  ;)

And thanks Patrick for the very accurate answers....

Xavier
Title: Re: Stm32F4Discovery port
Post by: norbim1 on June 27, 2014, 02:49:50 PM
Hi Xavier,

I'm just a hobbyist so I  don't have registered yet to Github and I'm quite new with it.
The CS part of my project is still left. As soon as it's ready, i'll fork it.

Thanks, Norbert
Title: Re: Stm32F4Discovery port
Post by: norbim1 on August 12, 2014, 12:24:40 PM
Hi,

I've managed to fork it and merged with the latest 1.04 fw:

https://github.com/norbim1/preenFM2

- STM32F4Discovery module based PreenFM2
- uses the onboard I2S codec, audio data send through DMA
- the CS buttons and encoders are directly connected to the IO ports of the module
- made some minor changes to the display driver, (I use a cheaper OLED module: Raystar REC002004AYPP5N00000)

I'll post the schematic and some pics of my newly built module soon. It was built on veroboard, so no PCB design has been made for it.

Regards Norbert
Title: Re: Stm32F4Discovery port
Post by: pld on August 12, 2014, 08:06:17 PM
Awesome, thanks for sharing. Definitely have to take a look at that...
Title: Re: Stm32F4Discovery port
Post by: norbim1 on August 12, 2014, 09:45:45 PM
Some pics about the gadget:

Title: Re: Stm32F4Discovery port
Post by: norbim1 on August 12, 2014, 09:47:14 PM
Schematic and a suggested veroboard wiring:
Title: Re: Stm32F4Discovery port
Post by: Xavier on August 13, 2014, 10:49:32 AM

Great project...  :D
Congrats and thanks for sharing.
Title: Re: Stm32F4Discovery port
Post by: norbim1 on August 13, 2014, 03:20:00 PM
Thanks a lot, but it's definitely your fantastic project's merit.
I'll try to keep the fork sync with the upstream repository.
Title: Re: Stm32F4Discovery port
Post by: yogi on November 26, 2014, 07:39:17 PM
  Norbim1,  Thank You very much for your port project (and your post over @ Midibox.org), I'm so very excited to find this! For along time I have watched the Preen project (had not seen the FM2 ver till now), so very cool; but could not bring myself to spend on 'yet another project' when my wish list is so long. BUT the Disco board is very inexpensive and very complete. So now there is a new build in my future.
 Not to take anything away from the great work of Xavier, but the 'F407 Discovery port opens this up for me :) Again Thank You both, life is good :)
Yogi
Title: Re: Stm32F4Discovery port
Post by: elea on December 22, 2014, 05:26:08 PM
norbim1: would it be possible to upload the compiled binaries (regular, overclocked & bootloader)?

I'm running 3 different STM32Fx toolchains right now (Spark Core, MIDIbox NG & Mutable Instruments) and am having trouble installing a fourth one that's compatible with your code :(
Title: Re: Stm32F4Discovery port
Post by: norbim1 on December 22, 2014, 09:29:59 PM
I'm using Eclips and MidiBox toolchain without any problem.
Anyway here is the binaries. I've made only the overclocked version for Stm32F4Discovery, so bootloader and overclocked only.
Title: Re: Stm32F4Discovery port
Post by: elea on December 22, 2014, 11:55:45 PM
Many thanks! I don't know why Eclipse was giving weird errors. I'll try this out tonight and compare it to my FS1r.
Title: Re: Stm32F4Discovery port
Post by: elea on December 23, 2014, 04:05:16 PM
Quick question: will this firmware work without an LCD attached?


Here were my errors compiling the boot binary:

Code: [Select]
C:\preenFM2\trunk>make boot
arm-none-eabi-c++  -Tlinker_bootloader/stm32f4xx.ld  -mthumb -mcpu=cortex-m4 -mf
loat-abi=hard -mfpu=fpv4-sp-d16 -gc-sections --specs=nano.specs   build/BootLoad
er.o build/usb_storage_usr.o build/usbd_storage_desc.o build/usbd_storage.o buil
d/usbKey_usr.o build/usb_bsp.o build/Encoders.o build/LiquidCrystal.o build/UsbK
ey.o build/Storage.o build/Common.o build/system_stm32f4xx.o build/stm32f4xx_gpi
o.o build/stm32f4xx_rcc.o build/stm32f4xx_flash.o build/stm32f4xx_usart.o build/
ff.o build/fattime.o build/usb_core.o build/usb_hcd.o build/usb_hcd_int.o build/
usb_dcd.o build/usb_dcd_int.o build/usbh_core.o build/usbh_hcs.o build/usbh_iore
q.o build/usbh_stdreq.o build/usbh_msc_core.o build/usbh_msc_bot.o build/usbh_ms
c_scsi.o build/usbh_msc_fatfs.o build/usbd_core.o build/usbd_ioreq.o build/usbd_
req.o build/usbd_msc_bot.o build/usbd_msc_core.o build/usbd_msc_data.o build/usb
d_msc_scsi.o build/misc.o build/startup_bootloader.o -o build/p2_boot_1.11.elf
build/BootLoader.o: In function `BootLoader::initKey()':
C:\preenFM2\trunk/src/bootloader/BootLoader.cpp:121: undefined reference to `Usb
Key::firmwareInit()'
build/BootLoader.o: In function `BootLoader::burnFlash()':
C:\preenFM2\trunk/src/bootloader/BootLoader.cpp:384: undefined reference to `Usb
Key::loadFirmwarePart(char*, int, void*, int)'
build/BootLoader.o: In function `BootLoader::process()':
C:\preenFM2\trunk/src/bootloader/BootLoader.cpp:141: undefined reference to `Usb
Key::readNextFirmwareName(char*, int*)'
C:\preenFM2\trunk/src/bootloader/BootLoader.cpp:157: undefined reference to `Usb
Key::firmwareInit()'
build/usbd_storage.o: In function `STORAGE_GetCapacity(unsigned char, unsigned l
ong*, unsigned short*)':
C:\preenFM2\trunk/src/bootloader/usbd_storage.c:138: undefined reference to `Usb
Key::diskioGetSectorNumber()'
build/usbd_storage.o: In function `STORAGE_Read(unsigned char, unsigned char*, u
nsigned long, unsigned short)':
C:\preenFM2\trunk/src/bootloader/usbd_storage.c:180: undefined reference to `Usb
Key::diskioRead(unsigned char*, int, int)'
build/usbd_storage.o: In function `STORAGE_Write(unsigned char, unsigned char*,
unsigned long, unsigned short)':
C:\preenFM2\trunk/src/bootloader/usbd_storage.c:195: undefined reference to `Usb
Key::diskioWrite(unsigned char*, int, int)'
build/Storage.o: In function `Storage::copy(char*, char const*, int)':
C:\preenFM2\trunk/src/hardware/Storage.cpp:36: undefined reference to `preenMain
Preset'
build/Storage.o: In function `Storage::copy_string(char*, char const*)':
C:\preenFM2\trunk/src/hardware/Storage.cpp:554: undefined reference to `midiConf
ig'
C:\preenFM2\trunk/src/hardware/Storage.cpp:554: undefined reference to `midiConf
ig'
build/Storage.o: In function `Storage::copy(char*, char const*, int)':
C:\preenFM2\trunk/src/hardware/Storage.cpp:36: undefined reference to `preenMain
Preset'
build/Storage.o: In function `Storage::getValue(char*, char*)':
C:\preenFM2\trunk/src/hardware/Storage.cpp:601: undefined reference to `midiConf
ig'
collect2.exe: error: ld returned 1 exit status
make: *** [build/p2_boot_1.11.elf] Error 1
Title: Re: Stm32F4Discovery port
Post by: norbim1 on December 23, 2014, 04:20:51 PM
I've never tried it without LCD. The control surface works exactly the same way as the original pFM2, I didn't change it.
Related to build errors I'm sorry, but I'm not an expert in it.
Title: Re: Stm32F4Discovery port
Post by: elea on December 23, 2014, 04:28:16 PM
No problem - I at least have your bootloader and I finally managed to get the rest compiled.

I'll get an LCD to test it.

Thanks again, norbim1.
Title: Re: Stm32F4Discovery port
Post by: rsproduction on September 21, 2016, 04:29:30 PM
Hi,
I built a low budget PreenFM (first version) using home made pcb and a maple mini clone, with a cheap 2004 LCD bought fm ebay...It works quite well!
Now I want to start the PreenFM 2 project on a low budget! I don't have the skill to code and compile the firmware...
Your stm32f4 Discovery porting is the best choice for me..
The questions are:
1) Is it possible to use your compiled bin (boot and firmware) using an ordinary (not oled) lcd (20*04)?
2) Once I've uploaded your boot loader to the Discovery board, is it possible to use the official and updated compiled firmware without any change?
2) What about the audio out quality of the Discovery? Could you please post some audio demo?

Thank you very much for your kindly reply!

S. Rizzo
Title: Re: Stm32F4Discovery port
Post by: Xavier on September 21, 2016, 10:11:03 PM

Hi,

1) I'm almost sure the answer is yes, as there's not reason the low level display code has been changed.
And the preenfm2 works with regular LCD.

2) No. Norbim's firmware uses the DAC of the discovery and different pins for devices.
But i just noticed the firmware is regularly updated on https://github.com/norbim1/preenFM2
Nice job by the way :)

Xavier
Title: Re: Stm32F4Discovery port
Post by: rsproduction on September 21, 2016, 10:27:45 PM
Thank you very much for your fast reply!
Your synth is fantastic!
Could you please compile them (boot and firmware) for me?
I don't have the necessary skill to do it now..  :(

Regards!
Title: Re: Stm32F4Discovery port
Post by: Xavier on September 22, 2016, 08:44:38 AM

You can start with the zip file from previous page.
It contains the bootlooder 1.11 (latest version) and an old firmware but that will allow you to setup and check your hardware.

I'll try to compile Norbim's latest firmware later.

Let us know how the build goes,

Xavier
Title: Re: Stm32F4Discovery port
Post by: rsproduction on September 22, 2016, 10:23:43 AM
Wonderful!

I'll try to begin with the old firmware...waiting for the (compiled) new one!

Many, many thanks!
Title: Re: Stm32F4Discovery port
Post by: norbim1 on September 22, 2016, 08:21:41 PM
Hi,
Here is the latest compiled fw.
Norbim
Title: Re: Stm32F4Discovery port
Post by: rsproduction on September 22, 2016, 11:34:43 PM
Hi,

thank you for the fw!
Can you please confirm, I can use an ordinary LCD 20*04... I read that you did some change on the display driver...
What about the audio quality of The Discovery DAC? Are you happy with it?

Tks again for your help!

Salvo
Title: Re: Stm32F4Discovery port
Post by: rsproduction on September 22, 2016, 11:57:11 PM
To Xavier...

Hi,

I've downloaded and study your schematics...I can't find the one relative to your uC board (FPreen405)?
Does it is open-hardware or not?
What type of minimum system do you use? The one of the CERB40?
Is it possible to have the schematic?
I'm looking to redesign the pcb to embed the uC...or at least to use a smd chip to dip converter and some THT components for resistors, xtal and caps...

Thank a lot for your beautiful project!

Salvo

p.s. in attached "my" PreenFM modular version
 
Title: Re: Stm32F4Discovery port
Post by: Xavier on September 24, 2016, 07:04:36 PM

I just uploaded the preenF405 schematic here :
https://github.com/Ixox/preenFM2/tree/master/hardware/preenF405

I don't understand your "minimum system" question.


Best,

Xavier
Title: Re: Stm32F4Discovery port
Post by: rsproduction on September 25, 2016, 08:58:58 AM
Hi,

fantastic, I've just dwnld the schematics! Thank you so much!

I meant with or without 32khz rtc xtal... as for CERB40 version one or two..

What I'm thinking is to use an lqfp64 to dip converter for the stm32f405 chip and put caps, resistors and xtal near it on a custom board... with the other components: dacs, opamps, conectors and so on.
What do you think, may be work?

Do you use stlink-v2 and the pins "P1" and "jump3" on the main PreenFM2 board to program (at least for the boot-loader) the preenF405 uC?

I made my own "singe side" pcb... to lower the cost for my projects (as I did with the version one of the PreenFM) so I want to try this way for your new project.

Best regards and tks again!  ;)

Salvo
Title: Re: Stm32F4Discovery port
Post by: opus.quatre on September 25, 2016, 10:03:55 AM
Hello there..
I dont understand much to this thread, but Norbim's box is absolutely beautiful !! Both the box, with the wooden sides, and the knobs..  a very delightful one..
Have a nice week-end..
Thierry
Title: Re: Stm32F4Discovery port
Post by: rsproduction on September 25, 2016, 10:22:23 AM
Hi,
sorry, I've digressed too much...
Yes, Norbim's solution is probably the best way for me... to get a working PFM2.

Tks again for your kindly help,

regards,

Salvo
Title: Re: Stm32F4Discovery port
Post by: norbim1 on September 25, 2016, 06:17:30 PM
Hi Salvo,

Sorry for the late answer. I'm sure any standard 20*4 LCD works with my code. At first my OLED didn't work properly, so I made some timing change to better follow the datasheet. Later it turned out, that the problem was with the supply voltage instead.
I'm really happy with the audio quality of the Discovery. In one of my projects I use an external I2S board with a Discovery, because I need audio input too. The onboard codec have way less noise than the external one. I think STMicro made a really good job with the F4Discovery board.

Thank You Thierry, I use this box design for my other small projects too. The wooden sides are made from bamboo cutting board.

Regards Norbim
Title: Re: Stm32F4Discovery port
Post by: rsproduction on September 26, 2016, 04:21:41 PM
Hi Norbim,

don't worry,  Tks for your reply.
I'm going to buy a Discovery to try your solution.
I'll keep you updated about the progress...

Regards, Salvo
Title: Re: Stm32F4Discovery port
Post by: opus.quatre on September 30, 2016, 06:26:29 PM
Thanx Norbim for your answer..
I see there is no volume knob on your version..
And where did you get those wonderful black and white knobs ??
Have a nice week end..
Thierry
Title: Re: Stm32F4Discovery port
Post by: norbim1 on October 01, 2016, 12:12:07 PM
Hi Thierry,

yes there is no hardware volume control, but I implemented midi CC 7, so you can control it via midi.
The knobs are form MidiBox forum group buy. AFAIK last batch was a year ago:
http://midibox.org/forums/topic/19657-albs-waldorf-knobs-bulk-order-2015-2016/
Title: Re: Stm32F4Discovery port
Post by: opus.quatre on October 01, 2016, 09:58:05 PM
Thanx Norbim.. I already knew that Waldorf were making beautiful machine.. but i didnt know they were also selling gorgeous knobs.. Thanx again..
Title: Re: Stm32F4Discovery port
Post by: opus.quatre on October 02, 2016, 01:04:42 PM
I've been browsing eBay to search for Stm32F4Discovery..
It seems that there are so many different versions.. I don't know which module is the ciorrect one..
Can you help ??
Have a nice sunday..
Thierry
Title: Re: Stm32F4Discovery port
Post by: norbim1 on October 04, 2016, 12:47:21 PM
Hi Thierry,
first check the original STMicroelectronics product page to know the orginal version:
http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-discovery-kits/stm32f4discovery.html
I bought all my Discovery boards from Farnell (farnell.com). The part number is STM32F407G-DISC1.
Title: Re: Stm32F4Discovery port
Post by: opus.quatre on October 04, 2016, 06:29:30 PM
Thanx Norbim..  I'll have a look..
Title: Re: Stm32F4Discovery port
Post by: rsproduction on December 05, 2016, 01:45:41 PM
Hi,
Here is the latest compiled fw.
Norbim

Hi,

I finally got my Discovery Board.

I'm doing my own "motherboard" pcb for the encoders, lcd and switchs...

How can I upload Your bootloader and firmware using the on-board USB connections?

I'm a newbie... ::)
 
Title: Re: Stm32F4Discovery port
Post by: norbim1 on December 05, 2016, 05:26:56 PM
Use the STM32 ST-LINK utility via the mini USB on the debugger side of the board.

http://www.st.com/content/st_com/en/products/embedded-software/development-tool-software/stsw-link004.html

Norbim
Title: Re: Stm32F4Discovery port
Post by: rsproduction on December 06, 2016, 07:32:09 AM
Hi Norbim,

many thanks for your kindly reply!
Can you confirm that I must Flash the bootloader at the adress 0×8000000 and the  firmware at the adress 0×8040000 ?

Best regrards,

Salvo
Title: Re: Stm32F4Discovery port
Post by: norbim1 on December 06, 2016, 08:49:02 AM
Yes, it should work this way.

Norbim
Title: Re: Stm32F4Discovery port
Post by: rsproduction on December 06, 2016, 11:40:06 AM
Perfect,

I'll try it!

Salvo
Title: Re: Stm32F4Discovery port
Post by: rsproduction on March 09, 2017, 07:19:36 PM
Finally got mine working!!

Thank you Norbim!

Thank you Xavier!

I hope to upload soon, on my website, some other info on how I built it.
I made my own "motherboard" pcb to host the stm32discovery board...
The total cost has been kept low!  ;)
Title: Re: Stm32F4Discovery port
Post by: Xavier on March 09, 2017, 09:49:28 PM

Very nice  and totally unique :)
Thanks for sharing !!!
Title: Re: Stm32F4Discovery port
Post by: electron libre on April 06, 2017, 03:35:44 PM
Hey norbim1 and rsproduction.

Can you provide me a bit more info ow to burn the Disco board. Is there some DFU mode? Also, the I dispose is a STM32f411.

Cheers
Title: Re: Stm32F4Discovery port
Post by: norbim1 on April 06, 2017, 04:08:32 PM
Hi, for the first time flashing:

[/quote]
Use the STM32 ST-LINK utility via the mini USB on the debugger side of the board.

http://www.st.com/content/st_com/en/products/embedded-software/development-tool-software/stsw-link004.html

Norbim

It should be STM32F407 on the board. Heere you can check the correct Discovery version:

first check the original STMicroelectronics product page to know the orginal version:
http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-discovery-kits/stm32f4discovery.html
I bought all my Discovery boards from Farnell (farnell.com). The part number is STM32F407G-DISC1.

Title: Re: Stm32F4Discovery port
Post by: electron libre on April 22, 2017, 04:15:48 PM
Thanks for the reply, norbim1

The STM32f411 has a different configuration, it is not an updated f407.

I made test with the board from my MidiSeq, which is an F407. I flashed, using STlink, the two files : p2_boot_1.11.bin at 0x08000000 and the p2_205o.bin at 0x08040000.

I also made some experiments attaching lcd pannels - one 4x20 and one 2x40, just to see some reaction.

Is there some step I am missing? There is noting on the LCD, should I wire all the wires and usb stick also?

I attach 2 shots with the flash process:

Cheers
Title: Re: Stm32F4Discovery port
Post by: rsproduction on April 23, 2017, 10:37:42 PM
Hi electron libre,

did you make the right connections btw stm32f407DISCO and LCD, did you try a contrast trimmer on the LCD 20*4?

Cheers

Title: Re: Stm32F4Discovery port
Post by: electron libre on April 24, 2017, 02:25:37 AM
Hello rsproduction, thanks for the reply

I wire the 4x20 LCD using the flowing schema:

pin 1 > GND
pin 2 > 5V
pin 3 > 10k pot, dividing a gnd/5V
pin 4 > PE8
pin 5 > GND
pin 6 > PE7
D0 to D3 > GND
D4 > PE9
D5 > PE11
D6 > PE13
D7 > PE15
And Backlight

The LCD Lights up, I can fix the contrast. All the charachers remain filled. Is there some step I am missing? Buttons combo, firmware activation. There is only the lsc attached, no buttons, encoders or USB memory.

My procedure of writing the bin files: first I upload the p2_boot_1.11.bin file at 0x08000000, after him the p2_205o.bin file at 0x08040000. I downloaded the files in earlier posts in this topic.

Correct me if I am wrong

Best regards
Title: Re: Stm32F4Discovery port
Post by: norbim1 on April 24, 2017, 09:37:19 AM
Hi,
AFAIK it wont work without USB stick. 5. question in FAQ: http://ixox.fr/forum/index.php?topic=63377.0 (http://ixox.fr/forum/index.php?topic=63377.0)

Norbim
Title: Re: Stm32F4Discovery port
Post by: electron libre on May 09, 2017, 02:40:16 PM
Hello Norbim1,
After a small pause on this project I managed to get it running. I enjoy the clear FM sound and the very nice presets.

Now I have some stability issues. After a random Interval of time, from 10 to 60 secs the synth freezes. This only occurs with the 205 firmware, at least I do not remember to have it running the 106 version. The error code on the LCD is never the same. I play the sent by usb midi, USB powered. The usb voltage is about 4.5V. Is this an issue of the over clocked version?

Best regards, and thanks again for this great synth!

Title: Re: Stm32F4Discovery port
Post by: norbim1 on May 09, 2017, 06:27:20 PM
Let's try with latest firmware. The only drawback is that in the mean time I changed my encoders, so with this they work with reverse turn direction. Either change your encoder A-B pins connections or let me know and I'll build a new .bin in a few days.
Title: Re: Stm32F4Discovery port
Post by: electron libre on May 09, 2017, 08:20:10 PM
Hey norbim1

After sever tests, the STM is still freezing, either playing or idle. Is there something I can do to assist you?

Cheers
Title: Re: Stm32F4Discovery port
Post by: norbim1 on May 10, 2017, 08:06:59 PM
Hi,
I think it can be a problem with the USB stick or the power line to it (the PC number shows that it hangs on the USB OTG_FS IRQ handler). Check the USB stick, or the lines going to it. If all goes well, try to filter the power lines near the USB stick socket.
Title: Re: Stm32F4Discovery port
Post by: Xavier on May 11, 2017, 09:38:27 AM
The goal of this register dump is to be able to find where the firmware crashed.
I'm away from my dev computer and I don't remember exacly the steps to debug.
The PC (program counter) value is where it crashed.

With a mix of gdb, elf binary, 'layout split' or asm, and a gdb function to go to the PC value, you should get the C++ line where it crashed.

Title: Re: Stm32F4Discovery port
Post by: norbim1 on May 11, 2017, 12:24:53 PM
Hi Xavier!

Thanks for the tip. I just checked the symbol list, and found, that at 08041AC0 there is the OTG_FS IRQ handler, and thought that the 0x28041AC0 dumped PC value can be the same with a memory mapping offset. I'll try to find it with gdb, though I only used it before to debug a connected target.
Title: Re: Stm32F4Discovery port
Post by: Xavier on May 11, 2017, 03:45:36 PM
Hi Xavier!

Thanks for the tip. I just checked the symbol list, and found, that at 08041AC0 there is the OTG_FS IRQ handler, and thought that the 0x28041AC0 dumped PC value can be the same with a memory mapping offset. I'll try to find it with gdb, though I only used it before to debug a connected target.

Yes RAM adress in the STM32F4 is 0x20000000. So this is the same adress moved into MCU RAM !
Title: Re: Stm32F4Discovery port
Post by: norbim1 on May 12, 2017, 02:04:39 PM
Hi electron libre,

Hi,
I think it can be a problem with the USB stick or the power line to it ....

by further analyzing the code I realized that the USB_FS_Core is responsible for the computer connection side, so You should check the PC USB connection instead. It can also be a USB power issue.
Title: Re: Stm32F4Discovery port
Post by: noyzelab on February 22, 2018, 06:55:07 AM
just posting a pic of non-functioning attempt at getting this firmware going on an old board. I ended up abandoning its previous project and removing other parts.. so thought might as well try and get it used for something.

I was wondering how easy it might be to get a minimal build to see if I can download the firmware correctly. Is it possible to just get a bare board+the required usb stick and test to see if appears over USB?

I didn't get anything on the LCD, but I was hoping might see something over the USB in a MIDI app but nothing..

I dont have much/any more time to look at it for now, but thought might try and revive this thread and see if anyone else has been trying this board?
Title: Re: Stm32F4Discovery port
Post by: domdel on July 22, 2020, 04:33:40 PM
Hi

  trying to build my own one (see attached pictures) it seems something is not going right: display does not light at all.
 
 I have triple checked all connections to be OK.
 As I have an OLED display, it needs full 5V and therefore V+ does not go through the diode next to USB connector. It does not need either V+ & GND on pins 15 & 16 neither the pin 3 needs the contrast signal.

 I have flashed the board from Linux, using the st-tools from debian.

 When connecting the Micro USB,

Therefore I have a few questions:

I am looking a ST documentation to see if it helps but I would be happy to hear from any knowledgeable person :-)
EDIT thus a question:


Regards
Dominique
Title: Re: Stm32F4Discovery port
Post by: solipsvs on July 22, 2020, 06:30:41 PM
this is the smd board?  did you get it on some electro forum?
Title: Re: Stm32F4Discovery port
Post by: domdel on July 22, 2020, 09:21:22 PM
Hi

 that is a STM32-f4 discovery board, following Norbim work, using his git repository https://github.com/norbim1/preenFM2 (https://github.com/norbim1/preenFM2). It is a fork of the standard PreenFM2 firmware to adjust to the differences one finds on that board like onboard DSP, no need for duplicating ports ...

 My issue seems to have purchased a 6800 type of display when, if I understand the code, the preenFM2 code for the LCD display (apparently not modified by Norbim) seems to address a 8080 type of communication.
  At the moment, I am trying to learn about differences and how that would alter the code.
  To start with, the Enable pin of the display works opposite : values seem to be taken into account on the descending front rather than High value.

  Whilst I am an "old" programmer, I am not familiar with "bare metal" and I look for some indications how I could tweak the code in LiquidCrystal.cpp and make it talk the 6800 dialect.

EDIT
mm well, I might have been too fast thinking I had found the cause. It seems some real PreenFM2 are using the same display (Vishjay 020N004A-GP-GPP05...) Hence my interpretation is probably wrong...

Regards
Dominique
Title: Re: Stm32F4Discovery port
Post by: norbim1 on July 23, 2020, 10:46:53 PM
Hi Dominique,

My version was made with an OLED display too, and it definitely needs the diode between V+ and +5V. The Disco board pins couldn't give enough high level for the OLED control, so I lowered the V+ supply a bit with the diode. Another solution would be some level shifters between the Disco pins and the OLED control pins.
I checked Your OLED's datasheet and the minimum input high level is the same as my screen: 0.8*VDD. This means that You need at least 4V, but the disco outputs only provide somewhere around 3V. The diode in the power line causes minimal brightness decrease while the input high level comes quite close to the needed value.

Norbim
Title: Re: Stm32F4Discovery port
Post by: domdel on July 24, 2020, 06:49:18 PM
Hi

  I see: with the diode , it gets ~ 4.3V (measured) and 4.3*0.8 =3.76 V, closer to 3.3V.

  That said, beyond the display, I also probably have a USB thumb drive problem. I read in FAQs it is current with >= 4GB, I am looking for a smaller one, my smallest current is 4GB.
  Would you know the reason? Tolerance to low tension? Size not managed by software? Other ?

  If the 3V3 vs. 5V is still a problem then I will contemplate purchasing something like a device like the Ti TBX0108 to adjust.

Regards
Dominique
Title: Re: Stm32F4Discovery port
Post by: domdel on July 25, 2020, 09:47:18 PM
Hi

  got another more tolerant display : a LCD this time (a 2004A).
  got a 2GB USB drive,

I tries with a recompiled fw 2.11, with the 2.08 that is with the sources, tried both normal and overclocked.
I use the Linux Debian 64 St-link tools for that purpose. Has anyone go positive or negative experience to share ?
I checked again a good 3 times all connections...

Nothing seems to  work :-(

Any help is welcome


EDIT
beyond likely USB key issues, I realize noting boots if I do not connect the mini USB CN1 to a computer, tested with other demo firmware.
Some people complain that depending on the ST-Link firmware, you may experience that issue... I checked the ST application for that, you do not have the choice of the ST Link firmware version, the one the application offers to upgrade to does not resolve the issue.

EDIT 2 Rebuilt a USB key, tried on crazy thing by error : re-flashed whilst on the motherboard and oh miracle: it boots, displays ...
HOWEVER : after that success: I just power it and ... nothing happens ...

@Norbim: had you to tweak anything on the BOOT0 and BOOT1 to start it ?
Do you know what ST-Link version your board has ?

I found numerous messages about recent versions of ST-Link causing that ... :-(


EDIT 3 Researching further, I found

Now debugging -- I needed a bootloader that compiles, as I was about to try and fix it, I remarked Xavier has issued one in 2.12-B3.
So far it seems trapped in a loop -- not sure why -- possibly because it does not look at the buttons where they are for the discovery board ? I dig deeper.

EDIT 4
Following up debugging -- admittedly not 1.11 bootloader but in that case, the difference seems minimal.
What happens :
in BootLoader.cpp, after construction of the object bootLoader in main, the test in line
fails because bootLoader.getButton returns 8 ! even in absence of any hit button or turned encoder, therefore it goes to the loop managing menu and loops because no button push is ever detected, probably because 2.12B3 has not the patches to match the board configuration.

Once again, not exact same bootloader but a refactored one, however the logics remains.

Where does bootLoader.button get changed ?
In the bootLoader constructor, it is set to 0 but , at the end, a call to "encoders.checkSimpleStatus();" somehow sets it to 8.

I am unsure the cause is the same on bl 1.11 & app 2.11 but that is my only way to try and resolve my problem.

I continue digging and maybe will attempt to port back this version of the bootLoader to the PreenFM on Discovery board so that buttons are read properly.

@Norbim: if ever you are working at porting the whole thing to 2.12 Beta3, please let me know in case I can help or you have done it already.

EDIT 5 EURÊKA ! The situation I found debugging the 2.12 B3 bootloader could well be what I had on 1.11. I checked and the bootloader I found in git is the same as the standard preenFm2. Searching attachments in this forum thread, I found the right one, all works  !!

I will try and port 21.12 Beta nonetheless, just for fun.

Regards
Dominique