Hot answers tagged

12

The series Rs resistors aren't for 'protection' pe se, the I2C spec notwithstanding (more about this below.) In any event, for Standard (100 KHz) and Fast (400 KHz) mode they're optional. For the higher-speed I2C modes (1 and 3 Mbit) they are used as series damping to reduce ringing and thus improve signal integrity. For that case, choose an Rs value such ...


6

Memory Memory systems come in two key varieties: volatile and non-volatile: Volatile memory is treated as though it powers up in a random state, though it may power up as all zeroes or all ones, too. Volatile memory has to be writable, or else it's not very useful. When you say "volatile" you mean at least these two things: uninitialized values at ...


4

Yes, current and voltage are the way to calculate these as per the I2C bus voltag and current specifications. Or more importantly, the voltage and current specs that the chips in your design have. In practice you would open the I2C specifications to find a chart with some example values, or rather limits for maximum series resistance versus pull-up ...


4

The example u32 update_file_mark = <initialisation>; you refer to is a global modifiable variable. ROM should be understood here as "Read Only Memory". Flash is considered Read Only Memory as a special procedure is needed to modify the contents, and also because the memory is considered Read Only by the compiled program. A special case is ...


4

STM32F103C8 is a 3.3V chip. The 74LS TTL series requires 5V. There are consequences to having a mixed voltage system that are not really worth explaining here. You should get the actual part unless you want to read and understand all the differences and make accommodations (spoiler: it will be more trouble than getting the correct parts). There are also ...


4

I think I've managed to recover the board, using STM32CubeProgrammer (not CubeIDE, this is a different program). The only thing I had to do was changing RDP to 0xAA (no protection) and now I can reprogram the IC. First install the program and click Connect to STLink, then:


3

The MIDI class is not supported by the STMCube HAL but it is well known and implemented, you just need to google a bit. I am currently doing a stm32 project with midi as well and I am using these two projects as reference: https://github.com/spectran/stm32f103-usb-midi https://github.com/ripxorip/stm32_usb_midi https://github.com/arneboe/con.trol Both have ...


3

many STM32 microcontrollers have a MCO output. (MCO standing for "Master Clock Out"). it's a general purpose clock output which is derived from a flexible selection of various clock sources and a clock prescaler. here's an image from the STM32F030 datasheet: The XCLK on 7670 could be from 10MHz to 48MHz. it's not 24MHz necessarily.


3

You need to activate GPIOD clock before accessing its registers. Also, documentation mentions that you may need to wait for a while after enabling the clock, before accessing the related registers. RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN; // Activate the clock __DSB(); // stall the CPU pipeline until the instruction is completed Also, don't let your program ...


3

From the HAL source code: DevAddress Target device address: The device 7 bits address value in datasheet must be shifted to the left before calling the interface n.b. shifted to the left by one bit.


3

You can route the execution into another loop, a clone of the first one but without the conditional check. Of course, you need another conditional for this routing, but once you reach there, you won't need to check a conditional on each iteration. If the loop resides in a function, you can clone the function excluding the condition check. Then all you need ...


3

Some points: LS chips are 5V only, you will need a stable 5V supply, not 3.3V. LS chips are far less forgiving in power supply issues. You might need (much) better Vcc decoupling than you needed with the HC's, at the very least one 100 nF cap per chip. LS chips require TTL (5V) input; the 2.0V for high is probably not a problem, but their inputs require ...


3

It means that the package of the chip actually has 4 physical pin pairs of VDD and VSS. Each of these supply pairs should be properly connected and decoupled to supply all parts of the chip reliably. Edit: Actually, the pair I marked on the left is the analog supply pair, which is shown separately in your schematic. So the package in my picture has only ...


3

If the accuracy of the internal oscillator is adequate for your application, then by all means use it. It saves a bit of cost and no board space is used by the parts needed for an external oscillator. But if you need accurate timing, then a crystal is the way to go. It's entirely up to you, as the designer, to determine what your application needs. For ...


2

It all depends on your protection goal. From what voltage (or current) do you need protection? (e.g. 1000V?) Typical (and well defined) scenarios are surge, burst or ESD protection. For these events, the serial protection resistors shown could be one piece of the solution, but you would need more than that (e.g. TVS diode). Look up the max. allowed voltage ...


2

There is an if check in while loop of a microcontroller. When something happens it detects it and does what is required. After that the microcontroller should not check this condition anymore to save CPU time. The correct approach depends on what your condition is. If "something happens" is a hardware event then you can use an interrupt to check ...


2

How to make above code look like below after button pressed and output switch is reset. It will not see any if check in its code... Is it possible to remove some program data from microcontroller flash memory, so it skips these deleted parts and continues with the rest. No, it is not realistically possible to do what you ask. Some MCUs can reprogram their ...


2

The STM32 HAL uses 8-bit addresses. Use 0xA0.


2

Direct connection of NRST to 3.3V VCC is wrong. Disconnect it.


2

All variables that are not constants live in SRAM. The variables that are uninitialized are actually initialized to zero by startup code when your program starts, and the variables that are initialized to some value, are initialized by copying their data from Flash to SRAM by the startup code.


2

Anytime you have a variable that is initialized to something other than 0 it is necessary to store that initial value somewhere; in a place where it will retain its value and be available when power is turned on. In other words, the initial value must be in some form of non-volatile memory. The term "ROM" is often used generically to indicate a non-...


2

Unless the startup code initializes the peripheral clocks for GPIOD peripheral, writing to GPIOD peripheral registers is useless. Use working examples and perhaps use CubeIDE instead of Keil, or at least let CubeMX to generate a working project base for you to compile in Keil.


2

You should use an external Crystal Osc. (XO) with the duty cycle specifications given. That will satisfy the pulse width variations given for the range of frequencies also given.


2

Datasheet says the MCUs are fully compatible, only memory size is different. The compiler should only use different linker script to change the RAM and Flash memory sizes. The compiled binaries should be identical, and you can also verify this.


2

All the analog pins are in the ADDITIONAL FUNCTIONS listed on pages 36 and following. For example from page 36 of the datasheet at: STM32 datasheet you have:


2

That is correct. You only need SWDIO & SWCLK. Most of the time NRST connection is not needed. AFAIK, debugger can send some kind of soft reset sequence using data and clock pins. Hardware reset pin may be needed if SWDIO & SWCLK pins are configured as GPIO pins (related with your 2nd question) just after the reset, thus preventing debugging. I have ...


1

There is too much capacitive coupling between SDA and SCL due to long wiring and bad selection of pinout on the module, where SDA and SCL are next to each other. The 10k pull-ups are too weak for this level of stray capacitance between the SDA and SCL. Make the pull-ups stronger, for example 1.2k pull-ups are much stronger but still within specification for ...


1

Thanks for all your suggestions, and sorry for the delay in getting back to you. Turns out my problem was in void LCD_Write_4_Digit_Number_Decimal(uint16_t Number) // print 4 digit number on screen { char buffer [4]; sprintf (buffer, "%4d", Number); LCD_Write_Text(buffer); } I increased "buffer" to 10 and suddenly I stopped ...


1

There are a few things which come to mind that can cause such behaviour. Somewhere in your code, you are activating an interrupt (may be in a driver call you're making) which occurs at that very moment, coincidentally. Yet, the interrupt has not been setup beforehand correctly (e.g. the entry in the IRQ table for that specific interrupt is missing) and it ...


1

JTAG/SWD can be used to change variables. Or you can make a simple serial console that allows to change the variables. Either with text commands like "p 3.14159" or simply make different letters change a value by some amount and print the new value out. Same can be achieved with pushbuttons and LCD, or by blinking LEDs, if you have no other ...


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