Hot answers tagged

26

I would have thought that you would need a loop around your code - while(1) { if (ip == 1){ op = 0; wait (1.0); op = 1;} else { op = 1;} } Before you have chance to press the button you code will have finished and exited. You need the while to keep the if statement repeatedly running.


21

#include "mbed.h" DigitalIn ip(D7); DigitalOut op(D8); int main() { if (ip == 1){ op = 0; wait (1.0); op = 1; }else{ op = 1; } // and now the program ends? What to do? } The processor executes the instructions sequentially. It starts with a jump to main() from within the mbed library initialisation code of ...


16

In your disassembly we see calls to 64 bit (double precision) math functions:- 08001956: bl 0x80004bc <__extendsfdf2> ... 0800195e: bl 0x8000564 <__muldf3> 08001962: bl 0x8000988 <__fixdfsi> The STM32F4 only supports 32 bit floating point in hardware, so these functions must be done in software and will take many cycles to execute. ...


14

No way. 2 million samples of 12 bits (ADC resolution) each means 3 MBytes/second. One byte is transferred as 10 bits (8 bits data, 1 start bit, 1 stop bit), so you'd need 30 MBits/s transfer rate. The STM32F401RE MCU on the board has a maximum APB2 clock frequency of 84 MHz. The maximal UART bitrate is 1/8 of the clock, that's 10.5 MBits/s.


8

In addition to dim's answer, which would indicate that you might try manually turning off peripherals before going into deep sleep (I don't know if this is handled by deep sleep all by itself) to see if this reduces your sleep current, you need to absolutely pore through the schematics for the Nucleo Board to see if there might be pull-ups, LED's, etc, that ...


8

FreeRTOS wasn't designed to support C++. https://interactive.freertos.org/hc/en-us/community/posts/210028906-Using-FreeRTOS-with-C- Since I don't see any other references to USART3_EXTI28_IRQHandler in your code, I assume there's some kind of framework (probably part of FreeRTOS) that actually requires that exact function name. So that gives me a hint that ...


7

A few options from simple to complex: JP1 is the usb power limit bypass jumper. When OFF, the ST/Link part of the board attempts to enumerate with high power request. If it successfully enumerates with the requested power, it enables the USB power Mosfet. When ON, it signals the ST/Link that External Power is being used, and should enable the power mosfet ...


6

As for any other processor, you will need a compiler that targets the CPU you're using. In other words, yes, you should/can use the GCC, but: you can't use the gcc that targets your PC, but need to use a GCC that targets the processor. In this case, the compiler would be called arm-none-eabi-gcc (for ARM ISA, with no OS, with the extended application ...


6

Well you define ext0 but try to use ex0. No wonder linking fails.


5

[Note: User Passerby interpreted the datasheet differently than I did, and he is correct. My answer will work, but his is the better way to do this. My answer does have some good info, though!] The quick answer is that you need to create a short across SB1 ("solder-blob 1"). As you can see by the name, they intend that you just drop some solder between the ...


5

I think there may still be some peripherals using a bit of current. The datasheet specifies about 1µA in stop mode with RTC enabled, but it also specifies that ~1.2µA is consumed by the PVD/BOR peripheral and ~1.7µA consumed by the internal voltage reference (see datasheet Table 41: Peripheral current consumption in Stop and Standby mode). I believe those ...


4

Actually everything is working perfectly. You have just configured the ADC in differential mode so that it measures the difference between PC0 and PC1. This difference can be positive or negative depending on whether PC0 is greater than PC1 or PC1 is greater than PC0. When they are equal to each other, the ADC reading is in the middle, which is what you are ...


4

What you describe seems normal. If the last data bit in a byte is low, the master must drive SDA throughout the high-low cycle of SCK which follows that bit. During the following high-low cycle of SCK, the master will need to release SDA and the slave will need to drive it, but between the two high-low cycles the master and slave are allowed to arbitrarily ...


4

As other answers state, you want to use arm-none-eabi-gcc to compile your code. However, compiled code (by itself) doesn't do much good! You need to convert it to an .elf or .hex format. You need to be able to load it to the microcontroller. You probably want to be able to debug the code on the target. I recommend using the free GNU ARM Embedded ...


4

It seems like your question really is how to desolder a 0805 resistor. This is easily done various ways: Use a single soldering iron. Turn up the temp a little higher than usual, like 700 °F. Melt the solder on one end. Then melt the solder on the other end. Go back and forth until everything gets hot enough so that the solder on one end takes ...


4

the basic deal with half-duplex mode is that it's going to clock until the SPE flag in SPI_CR1 is unset. The HAL_SPI_Receive doesn't unset this until its received a byte. By the time it gets around to unsetting this flag, the next transfer has already started. To properly receive the number of bytes you want, using half-duplex mode, follow the procedure in ...


3

I don't know why this didn't work, but xcopy command works well:


3

This script works for me. It's very important to initialize and configure ADC before configure the temp sensor part. /#define TEMP130_CAL_ADDR ((uint16_t*) ((uint32_t) 0x1FF8007E)) /#define TEMP30_CAL_ADDR ((uint16_t*) ((uint32_t) 0x1FF8007A)) /#define VDD_CALIB ((uint16_t) (300)) /#define VDD_APPLI ((uint16_t) (330)) int32_t ComputeTemperature(uint32_t ...


3

I finally find the solution. Instead of using the function deepsleep I use HAL_PWR_EnterSTOPMode() function with the clear wake up flag. Like that HAL_PWR_EnterSTOPMode(PWR_CR_LPSDSR | PWR_CR_CWUF, PWR_STOPENTRY_WFI);


3

Here is a STM32 Nucleo (64 pins) schematics. In archive you will find PDF schematic as well. I have not tried it myself, but it seems that you should be able to connect ST-Link like this:


3

ST doesn't have a "standard perhiperals library" for L4 as they used to have for other chips, but was discontinued and replaced by STMCube. STM32CubeL4. However, ST does have Low-Level API. This is new, and is more similar to the old "std periph". These start with: stm32l4xx_ll_. All of which are found in the STMCubeMX tool. DSP library is found in CMSIS, ...


3

Previously (using an F4) there has been a __HAL_TIM_SetCompare macro in the stm32fxxx_hal_tim.h file. That was indeed some time ago. I've found a copy of STM32CubeF4 V1.6.0 (released 28-May-2015) lying around in an old project directory, and it already has the following alias definition Inc/Legacy/stm32_hal_legacy.h:#define __HAL_TIM_SetCompare ...


3

I understand that the DMA interrupts may be occurring so often that it may not allow other interrupts to occur, so I have changed the priority for the DMA to be low as possible [...] I don't understand why the main while loop will not execute if the ADC DMA is enabled. If DMA interrupts were occuring so oft, that they would prevent other interrupt ...


3

One of the issue I find is the jumper settings By default, both jumpers SB48 and SB49 are open. Reference: Schematics of Nucleo F401RE Second way is to later measure the resistance from the resistors highlighted and connector CN7 pin numbers 25 and 27. If the hardware settings is fine, you should read zero ohms approximately.


3

Use the internal pullup and pulldown resistors. As long as a pin has nothing connected to it, and it's an input pin, setting the corresponding bits in GPIOx_PUPDR will activate pullup or pulldown resistors, directly affecting the pin state. It will not only simulate the pin going high or low, but the voltage will actually appear on the pin. The current ...


3

Even an ST Link does not provide target power. You connect Vcc to power the level shifter in the ST Link. Such that the ST Link does not blow up an 1.8V target. The budget version of the ST Link on the development boards do not offer this, and are only capable of interfacing with 3.3V targets. If your target is 3.3V, and not powered from elsewhere, you can ...


3

Some remarks: About your problem: You made a typo, you use ex0 while you mean ext0. It is always good practice to initialize variables. Besides that, you only set the variable, but you do not use it (maybe you did not show that code). Externally declared variables are best to put in the dedicated protected region at the beginning of the file. So your code ...


2

The line printf("%ld\r\n,count"); will always send "\r\n,count", which is 8 bytes, and likely not what you want. You probably meant to write : printf("%ld\r\n",count); However, as Dave Tweed explained, it is unlikely the UART will run fast enough. After the first millisecond, the count will be 4 digits, so that printf will try to print at least 6 bytes, ...


2

The problem is with your code. The RTC registers are part of the backup-domain, and this part is not reseted during Standby mode. From reference manual. SRAM and register contents are lost except for the RTC registers, RTC backup registers and Standby circuitry It is you who resets the RTC config. On wakeup, the code will be executed from the begining ...


2

I have been working with the STM32's internal temperature sensor based on the datasheet and reference manual. You can find the step by step guide for the sensor in the reference manual: Reading the temperature Select the ADC_IN18 input channel Select an appropriate sampling time specified in the device datasheet (TS_temp). Set the TSEN bit ...


Only top voted, non community-wiki answers of a minimum length are eligible