I'm busy bring up some new hardware with a STM32F030C8 mcu. I'm using the STM32CubeIDE with gcc. I'm very new to microcontroller development and this is my first project with ST and their tools.
This is a very basic program that just triggers a GPIO. The rest is all generated code. As I have very little experience in this field I hope somebody can point to a location where I can look. I suspect that it might be a configuration issue.
Here is the code (I removed all generated comments to keep it a bit more compact):
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_2); //my code 1
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_2); //my code 2
while (1)
{
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_2);
HAL_Delay(1000);
}
}
When I step through the code It will trigger the GPIO on "my code 1" once I step to "my code 2" it will cause the issue. I have even tried just running a fully generated program with no modifications and the issue persists. This was a quick test to see if the program actually does run on the mcu. And it does, as well as trigger the GPIO.
Debugger console Output:
Temporary breakpoint 1, main () at ../Core/Src/main.c:74
74 HAL_Init();
Program received signal SIGTRAP, Trace/breakpoint trap.
0x1fffecec in ?? ()
The Temporary breakpoint is where the program starts, I can then either run from there. Or step through, all with the same result.
Console Output:
Waiting for debugger connection...
Debugger connected
-------------------------------------------------------------------
STM32CubeProgrammer v2.4.0
-------------------------------------------------------------------
ST-LINK SN : 34FF6E065250343816210143
ST-LINK FW : V2J36S7
Voltage : 3.22V
SWD freq : 4000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x440
Device name : STM32F05x/F030x8
Flash size : 64 KBytes
Device type : MCU
Device CPU : Cortex-M0
Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_PEkdAh.srec
File : ST-LINK_GDB_server_PEkdAh.srec
Size : 4944 Bytes
Address : 0x08000000
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 4]
Download in Progress:
File download complete
Time elapsed during download operation: 00:00:00.627
Verifying ...
Download verified successfully
Full Error:
Break at address "0x1fffecec" with no debug information available, or outside of program code.
Here is two images that might help. As I mention I'm very new to this. So any other information required please ask. Thanks in advance.
Debug View
Disassembly
The code is placed at 0x08000000. There is no user code at 0x1fffecec. It system area and probably it boots the system bootloader. It shows that the BOOTx pin is incorrectly connected.
This question may be so obvious it is stupid but I am failing to come up with an answer for it.
I am trying to make a simple makefile project for the sam4s xplained board from Atmel.
I am new to ARM and am feeling a bit lost in how to get stuff to work. Here is what I do trying to get the LEDs to work:
/* Enable clock for PIOC. */
PMC->PMC_WPMR = PMC_WPMR_WPKEY_PASSWD;
PMC->PMC_PCER0 = PMC_PCER0_PID13; /* PIOC clock enable. */
/* Enable output for LED. */
PIOC->PIO_WPMR = PIO_WPMR_WPKEY_PASSWD; /* Enable writing to registers. */
PIOC->PIO_PER = PIO_PER_P10 | PIO_PER_P17; /* Enable pio 10, 17. */
PIOC->PIO_OER = PIO_OER_P10 | PIO_OER_P17; /* Set pio10 and 17 as output. */
PIOC->PIO_SODR = PIO_SODR_P10; /* Set pio10. */
PIOC->PIO_CODR = PIO_CODR_P17; /* Clear pio17 . */
But absolutely nothing happens. Am I missing something?
There should be user LEDs at PIOC 10 and 17.
Board schematics:
http://www.atmel.com/webdoc/sam4s16xplained/sam4s16xplained.boardScematics.section_ggo_tyg_xf.html
The problem was not in the code but in Atmel's tools used to program the board. I had been using SAM-BA In-system Programmer to program the board but for some reason it failed to change the contents of the flash. Even setting a single manually in the memory view fails.
I instead tried Seggers JLink software and did the following steps:
Update the JLink driver on the board using Atmel Studio 6 (this step requires windows).
Downloaded the J-Link software package for Linux from Segger: https://www.segger.com/jlink-software.html.
Using JLinkExe to program the board, like so:
Make sure JP25 is disconnected - only needed for sam-ba.
Connect via usb with the jtag connector.
Start JLinkExe
In the JLink terminal do:
JLink> device at91sam4s16c
JLink> loadbin <target.bin>, 0x400000
Sometimes I need to reset the board before it works after programming it. Using the Segger tools debugging also works now. Start gdb server with JLinkGDBServer and connect with arm-none-eabi-gdb using:
(gdb) target remote :2331
(gdb) file <target.elf>
My NodeMCU program has gone in to infinite reboot loop.
My code is functionally working but any action I try to do, e.g. file.remove("init.lua") or even just =node.heap(), it panics and reboots saying: PANIC: unprotected error in call to Lua API (not enough memory).
Because of this, I'm not able to change any code or delete init.lua to stop automatic code execution.
How do I recover?
I tried re-flashing another version of NodeMCU, but it started emitting garbage in serial port.
Then, I recalled that NodeMCU had two extra files: blank.bin and esp_init_data_default.bin.
I flashed them at 0x7E000 and 0x7C000 respectively.
They are also available as INTERNAL://BLANK and INTERNAL://DEFAULT in the NodeMCU flasher.
This booted the new NodeMCU firmware, all my files were gone and I'm out of infinite reboot loop.
Flash the following files:
0x00000.bin to 0x00000
0x10000.bin to 0x10000
And, the address for esp_init_data_default.bin depends on the size of your module's flash.
0x7c000 for 512 kB, modules like ESP-01, -03, -07 etc.
0xfc000 for 1 MB, modules like ESP8285, PSF-A85
0x1fc000 for 2 MB
0x3fc000 for 4 MB, modules like ESP-12E, NodeMCU devkit 1.0, WeMos D1 mini
Then, after flashing those binaries format its file system (run "file.format()" using ESPlorer) before flashing any other binaries.
Downloads Link
I've just finished working through a similar problem. In my case it was end-user error that caused a need to forcibly wipe init.lua, but I think both problems could be solved similarly. (For completeness, my problem was putting a far-too-short dsleep() call in init.lua, leaving the board resetting itself immediately upon starting init.lua.)
I tried flashing new NodeMCU firmware, writing blank.bin and esp_init_data_default.bin to 0x7E000 and 0x7C000, and also writing 0x00000.bin to 0x00000 and 0x10000.bin to 0x10000. None of these things helped in my case.
My hardware is an Adafruit Huzzah ESP8266 breakout (ESP-12), with 4MB of flash.
What worked for me was:
Download the NONOS SDK from Espressif (I used version 1.5.2 from http://bbs.espressif.com/viewtopic.php?f=46&t=1702).
Unzip it to get at boot_v1.2.bin, user1.1024.new.2.bin, blank.bin, and esp_init_data_default.bin (under bin/ and bin/at/).
Flash the following files to the specified memory locations:
boot_v1.2.bin to 0x00000
user1.1024.new.2.bin to 0x010000
esp_init_data_default.bin to 0xfc000
blank.bin to 0x7e000
Note about flashing:
I used esptool.py 1.2.1.
Because of the nature of my problem, I was only able to write changes to the flash when in programming mode (i.e. after booting with GPIO0 held down to GND).
I found that I needed to reset the board between each step (else invocations of esptool.py after the first would fail).
Erased the flash. esptool.py --port <your/port> erase_flash
Then I was able to write a new firmware. I used a stock nodeMCU 0.9.5 just to isolate variables, but I strongly suspect any firmware would work at this point.
The only think that worked for me was python flash tool esptool in ubuntu, windows flashtool never deleted init.lua and reboot loop.
Commands (ubuntu):
git clone https://github.com/themadinventor/esptool.git
cd esptool
python esptool.py -h
ls -l /dev/tty*
nodemcu_latest.bin can be downloaded from github or anywhere.
sudo python esptool.py -p /dev/ttyUSB0 --baud 460800 write_flash --flash_size=8m 0 nodemcu_latest.bin
I have a problem.I have an evaluation kit and a starter_kit program which works pretty well with the toolsuites plugin of the IDE under WINDOWS xp.The same toolsuites plugin of the IDE sous Ubuntu 12.0.4 does work but doesn't do the same thing.Weired no ? just for information, my tools are:
MCU:PIC24HJ128GP504
Board:MPLAB STARTER KIT for PIC24H MCU
USB connection for load/debug SKDE PIC24H SENSOR
IDE:MPLABX IDE v1.85
C compiler:XC16 V1.11
source code: starter kit for pic24 H sensor Demo
in UBUNTU, I compile and link that source code in MPLAB X ide using XC16 C compiler without any error and then program the device but then after that Microchip logo (start-up exercise) appears on OLED,the other parts of the code are not executed (
Home screen e.g).and OLED just blinks and repeats showing Microchip logo while blinking.seems to me that it enters to a RESET LOOP.
What is weird is that when i change the OS from ubuntu to windows xp and use the same IDE installed on windows xp and same C compiler and program the device, it works perfect and doesn't enter to this seemingly reset loop.and it shows Microchip logo(start-up exercise) and executes the rest of the program(which is a Home screen).
and I don't know what is wrong.
I used this step to debug this problem with no succeed, and i would like to know what you would do if you're in my case, and if you can help me find my problem.
compare map files (linker outputs):
the two files are almost the same except that map of winXP has a resetPRI function, but that of ubuntu uses reset(which seems to me that it's a memory section, not a function).you can see the common part of map file and the differences below.
External Symbols in Program Memory (by address):
0x000200 __resetPRI
Memory Configuration:
Name Origin Length Attributes
data 0x000800 0x002000 a !xr
reset 0x000000 0x000004
program 0x000200 0x015600
LOAD libp24HJ128GP504-elf.a
.reset 0x000000 0x4
0x000000 0x2 SHORT 0x200 ABSOLUTE (__reset)
0x000001 0x2 SHORT 0x4
0x000002 0x2 SHORT 0x0 ((ABSOLUTE (__reset) >> 0x10) & 0x7f)
0x000003 0x2 SHORT 0x0
.text 0x000200 0xf06
libpic30-elf.a(crt0_standard.o)
0x000200 __reset (difference:from ubuntu map file)
0x000200 __resetPRI (difference:from winxp map file)
build/default/production/_ext/1360937237/**Main.o**
_0x40c515645214dac2 (difference:from ubuntu map file)
_0213CF005214c228 (difference:from winxp map file)
0x2600 0x1c0
_0x40c515645214dac2 (difference:from ubuntu map file)
_0213CF005214c228 (difference:from winxp map file)
0x2600 0x1c0 build/default/production/_ext/1360937237 /Accelerometer.o (ONE function in the program )
0x2600 _BufferA
_0x40c515c05214dac2 (difference:from ubuntu map file)
_0213D1205214c228 (difference:from winxp map file)
any idea where should i look for the problem would be greatly appreciated.
Fatfs is a small library written in C ansi that lets us manage a file system on a storage device. I am planning on using it in an embedded project in order to store several files on an SD Card.
Therefore I try to make some tests on a USB flash drive, having downloaded the provided examples. I can mount my usb flash drive.
After having compiled the sources without the option FS_READONLY, I have initialized my drive and mounted it as well. But I cannot create a directory!
Here is the commands I entered within the prompt example provided here: http://elm-chan.org/fsw/ff/ffsample.zip
>fi 2 (force initialisation)
rc=0 FR_OK
>di 2 (mount the drive)
rc=0
Sector size = 512
Number of sectors = 30282525
>fj (switch the current drive to '2', which is actually my usb stick)
rc=0 FR_OK
>fk foo (Attempt to create a dir called 'foo')
rc=1 FR_DISK_ERR
Taking a look at the documentation, we're informed that FR_DISK_ERR refers to an hardware error.
Is my flash drive badly formated? Did I miss something else during the initialisation?