Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32 Port #68

Closed
MockbaTheBorg opened this issue Nov 12, 2018 · 9 comments
Closed

STM32 Port #68

MockbaTheBorg opened this issue Nov 12, 2018 · 9 comments

Comments

@MockbaTheBorg
Copy link
Owner

Hi All,

I have pulled my STM32 board from the drawer and gave it a try on the Arduino.
It seems to work fine with code from this project: https://www.stm32duino.com/
Source code here: https://github.com/rogerclarkmelbourne/Arduino_STM32
SD Library here: https://github.com/stm32duino/STM32SD (I have not tested this yet)
There's a good chance this will work for running RunCPM.

I have tried compiling RunCPM for it but got some errors, also, the code needs defines to use different settings when building for this board. Not sure when I will be able to port it, but if anyone wants to give it a try, check pages the above.

I am not using the guy's STM32duino boot loader, as I feel it is not needed, you can program the STM board from Arduino using the on-board st-link. Needs to install the ST-Link driver btw.

I was able to load a led-blink program onto it, which is already some progress.

Cheers,
Mockba.

@MockbaTheBorg
Copy link
Owner Author

Tried this one as well: https://github.com/stm32duino/Arduino_Core_STM32
No luck so far.

@MockbaTheBorg
Copy link
Owner Author

I was able to port RunCPM to the STM32F4DISCOVERY board.
It is still unstable, but with promising results.
The steps to implement are:

1 - Install Arduino STM32 core from https://github.com/stm32duino/Arduino_Core_STM32 via the package manager.
2 - Install FatFs and STM32SD libraries via the library manager.
3 - Edit the stm32f4xx_hal_conf.h file for the board and uncomment #define HAL_SD_MODULE_ENABLED
4 - Edit the ffconf_default_68300.h file from the STM32SD library and set #define _FS_TINY 1
5 - Build, install.
6 - Plug a serial adapter to PA2 (TX) and PA3 (RX)
7 - Press reset (black) button.

RunCPM should show the greeting.

At this point I am not 100% sure of the correct operation of the file system, so be aware that file corruption can occur.

@MockbaTheBorg
Copy link
Owner Author

Further investigation leads me to think there's a memory leak on the SD card handling.
Multiple DIR commands lead to a crash ...

So far I was not able to replicate.

@MockbaTheBorg
Copy link
Owner Author

STM32 board back to the drawer for now. Maybe I will revisit in the future if there's free time.

@MockbaTheBorg
Copy link
Owner Author

Port complete.

@linker3000
Copy link

Any tips for compiling for the STM32F411 Nucleo?

I have followed the instructions for setting up the discovery board (above)
and found/confirmed every settings change, but when I compile with 'Board Nucleo-64' and 'part number Nucleo F411RE', the compilation fails at "PD13 was not declared in this scope"..

#if defined _STM32_DEF_ // STM32 boards
  SdFatSoftSpiEX<PC8, PD2, PC12> SD; // MISO, MOSI, SCK
  #define SDINIT PC11 // CS
  #define LED PD13  <<<<<< 

Is this setup missing a pin definition file?

Thanks

@MockbaTheBorg
Copy link
Owner Author

MockbaTheBorg commented Jun 24, 2019 via email

@linker3000
Copy link

linker3000 commented Jun 24, 2019 via email

@linker3000
Copy link

linker3000 commented Jun 24, 2019

Working on the STM32F411 Nucleo!

STM code section below. Once running, the tty comes through the embedded ST-Link interface apparently fine and I can see the console in the Arduino IDE or using minicom.
See the note in the code about the SD card activity LED.


  #if defined _STM32_DEF_ // STM32 boards

    // Important note - Arduino IDE build options for Nucleo board:
    //   U(S)ART Support: Enabled (Generic 'Serial')
    //   USB Support (if available): CDC (no generic 'Serial')
    
    // F411RE uses MISO = PA6 (D12), MOSI = PA7 (D11), SCK = PA5 (D13) 
    // (See note about LED below), CS = PB6
    SdFatSoftSpiEX<PA6, PA7, PA5> SD; // MISO, MOSI, SCK
    #define SDINIT PB6 // F411RE uses CS = PB6 (D10)

   #define LED PA8 // STM32F411 Nucleo has an LED on PA5 (SCK), which will flash during SD access. 
                // Application-controlled LED now reassigned to a different
                // pin so we don't drive the SCK line. Stick an LED + resistor
                // on it if you want two LEDs for SD access! PA8 is Arduino pin D7

    #define LEDinv 0 // 0=normal 1=inverted
    #define BOARD "STM32F411 Nucleo"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants