CMSIS definition from https://github.com/stm32duino/Arduino_Core_STM32/blob/main/system/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h
I think this should be enough:
// Write to register
RNG -> CR = 0;
RNG -> CR = (RNG -> CR ) | RNG_CR_RNGEN; // enable bit
RNG -> CR |= RNG_CR_RNGEN ...
Search found 150 matches
- Mon Nov 21, 2022 4:05 pm
- Forum: General discussion
- Topic: possible to direct access RNG registers of 32F411 via arduino-ide?
- Replies: 11
- Views: 4077
- Thu Oct 06, 2022 7:01 pm
- Forum: General discussion
- Topic: Real quicky, Which timer is safe to use?
- Replies: 7
- Views: 9375
Re: Real quicky, Which timer is safe to use?
Almoust as bluepill. Your board just don't have Timer4 compared to bluepill. But RM0008 apply to your board too.
I am not familiar wirh Roger's core DMA syntax, but i'm pritty sure there must some command to set lenght of DMA transfers ( for CNDTR register).
I am not familiar wirh Roger's core DMA syntax, but i'm pritty sure there must some command to set lenght of DMA transfers ( for CNDTR register).
- Thu Oct 06, 2022 6:28 pm
- Forum: General discussion
- Topic: Real quicky, Which timer is safe to use?
- Replies: 7
- Views: 9375
Re: Real quicky, Which timer is safe to use?
I was experiment with DMA to ODR, but with official core, and directly with registers.
From what i understand, on bluepill, you can only use DMA1 to send either PortA or PortB, not both.
In your example,
dma_setup_transfer(DMA1, DMA_CH0, &GPIOA->regs->ODR, DMA_SIZE_16BITS, &dataA[step], DMA_SIZE ...
From what i understand, on bluepill, you can only use DMA1 to send either PortA or PortB, not both.
In your example,
dma_setup_transfer(DMA1, DMA_CH0, &GPIOA->regs->ODR, DMA_SIZE_16BITS, &dataA[step], DMA_SIZE ...
- Fri Sep 02, 2022 7:12 pm
- Forum: General discussion
- Topic: STM32L0 - how to check available RAM memory
- Replies: 3
- Views: 3553
Re: STM32L0 - how to check available RAM memory
I once found same thing in SdFat library, called "FreeStack.h"
From that, simple sketch should work (at least at STM32F1/4):
// from SDfat library
extern "C" char* sbrk(int incr);
// free RAM (actually, free stack
inline uint32_t FreeBytes() {
char top = 't';
return &top - reinterpret_cast<char ...
From that, simple sketch should work (at least at STM32F1/4):
// from SDfat library
extern "C" char* sbrk(int incr);
// free RAM (actually, free stack
inline uint32_t FreeBytes() {
char top = 't';
return &top - reinterpret_cast<char ...
- Sun May 15, 2022 10:02 am
- Forum: Projects
- Topic: How do I adapt this 8 bit ladder DAC for STM32F401 Black Pill?
- Replies: 7
- Views: 6892
Re: How do I adapt this 8 bit ladder DAC for STM32F401 Black Pill?
just 2 cents, if you are changing all the bits in one go, you may as well use ODR.
for BSRR, to do the same, it may be 2 transactions, first reset all bits, then set the bits again separately.
the alternate would be to do things like
GPIOA->BSRR = value | (~ value << 16);
I agree. In this ...
- Sun May 15, 2022 9:02 am
- Forum: Projects
- Topic: How do I adapt this 8 bit ladder DAC for STM32F401 Black Pill?
- Replies: 7
- Views: 6892
Re: How do I adapt this 8 bit ladder DAC for STM32F401 Black Pill?
RM0368, page 161
In short, upper 16 bits of BSSR resets corresponding bits (1=reset, 0=don't change), and lower 16bit set corresponding bits (1=set, 0=don't change).
Set bits have priority over reset bits.
BSRR - Bit Set/Reset Register
Code: Select all
GPIOA->BSRR = uint32_t ( bits );
Set bits have priority over reset bits.
BSRR - Bit Set/Reset Register
- Sun Mar 13, 2022 8:20 am
- Forum: General discussion
- Topic: How to dynamically change duty cycle with HardwareTimer library?
- Replies: 24
- Views: 15705
Re: How to dynamically change duty cycle with HardwareTimer library?
To my understanding (as a hobby user) :
setCaptureCompare is 0 indexed, CounterCompare Register (CCRx) is 0 indexed
setOverflow is 1 indexed, Hardware AutoReload Register (ARR) is 0 indexed.
setPrescaleFactor is 1 indexed, Prescaler register (PSC) is 0 indexed.
To set duty cycle to 100 ...
setCaptureCompare is 0 indexed, CounterCompare Register (CCRx) is 0 indexed
setOverflow is 1 indexed, Hardware AutoReload Register (ARR) is 0 indexed.
setPrescaleFactor is 1 indexed, Prescaler register (PSC) is 0 indexed.
To set duty cycle to 100 ...
- Sat Mar 12, 2022 6:55 am
- Forum: General discussion
- Topic: How to dynamically change duty cycle with HardwareTimer library?
- Replies: 24
- Views: 15705
Re: How to dynamically change duty cycle with HardwareTimer library?
Hmmm, now even i am not sure anymore :lol:
Goal was not to count cycles, but use setCaptureCompare to set 0% duty cycle with value 0, and 100% with value 255.
And now i am not sure of that edge case. I think CounterCompare need to be greater than overflow to get 100% duty cycle. Overflow of 255 ...
Goal was not to count cycles, but use setCaptureCompare to set 0% duty cycle with value 0, and 100% with value 255.
And now i am not sure of that edge case. I think CounterCompare need to be greater than overflow to get 100% duty cycle. Overflow of 255 ...
- Fri Mar 04, 2022 11:05 pm
- Forum: General discussion
- Topic: How to dynamically change duty cycle with HardwareTimer library?
- Replies: 24
- Views: 15705
Re: How to dynamically change duty cycle with HardwareTimer library?
- use "pwmTim->setCaptureCompare(..." as first line of code in interrupt callback. No matter how long you calculations are, interrupt latency is usually same, so you'll have steady timing. Plus, once value of counter-compare is written, it will apply that value in next timer overflow. From my ...