From OpenMBD
Jump to: navigation, search

Problems in the model

The project contains 'Unresolved Link' blocks

TroubleshootingSTM32 UnresolvedLink.png
This probably means the paths haven’t been set correctly. Make sure the current folder of MATLAB® is the same folder as where the model file (.slx) is located. Close and reopen the model file once you have set the correct directory in MATLAB®, you should see the directory ‘blockset’.
TroubleshootingSTM32 CurrentFolder.png

Alternatively to reopening the model you can run the m-script librarySetup.m after redirecting MATLAB® to the correct directory.

Problems during the build procedure

“### Real-Time Workshop build procedure for model: 'controller_Olimexino_STM32' aborted due to an error.”

There are a few possible errors with multiple causes during the build procedure.

Gmake: ***[model.obj] Error 1

After pressing the ‘Build model’ button or Ctrl+b the following error appears:
TroubleshootingSTM32 BuildError1.png

Possible problem:
There is a space in the folder where the model resides. Because of this the compiler cannot find the specified folder. See above: the compiler is directed to ‘target\trunk\Target\controller_Olimexino_STM32_rtw’, this path is missing the ‘C:\...” The full path was: ‘C:\STM32\Target\trunk\Target\controller_Olimexino_STM32_rtw’.

Gmake: *** [<modelname>.obj] Error 1

After pressing the ‘Build model’ button (Ctrl+b) the following error appears:
TroubleshootingSTM32 BuildError2.png
Possible problem:
The ‘Simulation cache folder’ and ‘Code generation folder’ in the Simulink Preferences are not empty and not directing to the target folder.
Empty the fields ‘Simulation cache folder’ and ‘Code generation folder’ in Simulink Preferences.

Gmake: *** [clean] Error 2

After pressing the ‘Build model’ button (Ctrl+b) the following error appears:
TroubleshootingSTM32 BuildCleanError2.png

Possible problem 1:
The PATH to the GNU ARM embedded toolchain is not set correctly in the environment variables.

Go to Environment Variables by right clicking ‘My Computer’ and selecting properties -> Click ‘Advanced system settings’ -> click ‘Environment Variables …’ Select the PATH variable and click edit to check/correct the folder location to: ‘C:\Program Files\GNU Tools ARM Embedded\5.4 2016q2\bin’.

Possible problem 2:
MATLAB® has not been run as administrator.

Run MATLAB® as administrator. See the MATLAB® installation section

Problems with flashing

Error during flash procedure with Microboot: 'Could not clear memory..'

When trying to flash the STM32 Olimexino via CAN or USB the following error appears:
TroubleshootingSTM32 MicroBootError31.png

The model was not set up for use with the boot loader
Set ‘HANcoder_BOOTLOADER=1’ at the make command in the configuration parameters of the model. See below..
TroubleshootingSTM32 ConfigParametersButton.png

TroubleshootingSTM32 ConfigParameters.png

Microboot is not started automatically after a build

After the build procedure Microboot is not started automatically to begin the flash procedure.

Possible problem 1:
Microboot is not located in the correct directory. MATLAB® takes it's current directory and then tries to find Microboot from there. It first goes up one level and then searches from there for /Host/MicroBoot/MicroBoot.exe. If MicroBoot.exe is not found, it cannot be started.
Place MicroBoot back in ../Host/MicroBoot relative to the current folder (directory that holds the model) or start MicroBoot manually.

Possible problem 2:
The AutoFlash function is turned off.
AutoFlash can be turned on by adding the Build settings block to the model and turning the function on in that block.

Problems with MATLAB® in general

Error building model: dialog out of screen boundaries

When starting the build procedure a dialog from HANcoder appears in the task bar but is not visible on the screen.
This is an Error that is in MATLAB® self. There has to be a ‘startup m-file’ in the beginning file of MATLAB® to prevent this from happening. Startup MATLAB®, in the left section of the program, the current folder section, the file is shown which MATLAB® starts with. Make a new script ( in the upper left corner ).Copy the following script into the m-file and call this file startup.m

figure('units','pixels','position',[680 678 560 420]);
close all;
set(0,'defaultfigureposition',[680 678 560 420]);

From now on, MATLAB® will execute this script first when it is started. The dialog will appear in the screen from now on.

Problems with driver installation

USB driver installation with Zadig.exe fails

When the openblt.cfg file is in a path with a long name the installation can fail. Switch to Advanced mode in the Options menu of the program to check if the Openblt.cfg file can be opened.

Another recurring problem is that the target board doesn't stay in the boot loader long enough to install the driver. The solution here is to keep the boot loader active, this procedure is different for the different targets: In the Olimexino pin D2 should be held low by placing a resistor (250 to 820 Ohm) between GND and pin D2. The boot loader in the E407 can be kept active by keeping the button (BUT) pressed while pressing and letting go the reset button. The same trick applies to the P405 but there the name of the extra button is WAKE UP.

If the above didn't help then try going to the device manager and uninstall the current driver. Open Zadig.exe again and set it in Advanced mode. Now load the preset device by selecting the OpenBlt.cfg file. Click the 'Install Driver' button and check the console output for errors.