Skip to main content
This topic has been closed for replies.

9 replies

T J
Senior III
December 25, 2019

did you initialise those pins at startup ? you would have to set the alternate function to GPIO.

did you use the cube ?

Ala
AlaAuthor
Senior
December 28, 2019

Dear T J

yes I did initialized them completely, otherwise it wouldn't work at all.

and yes I used the cube, is it wrong?

S.Ma
Principal
December 25, 2019

how did you define the port pins? Push pull, internal pull-up, etc... there the pin configuration is missing.

Ala
AlaAuthor
Senior
December 28, 2019

yes I didn't bring them up here as it would made my code hard to understand, so I just mentioned the relevant parts.

T J
Senior III
December 28, 2019

if you want to send the cube file over, we will look a it..

why didnt you name the pins? so much easier to follow.

T J
Senior III
December 25, 2019

not using the cube ?

oeliks
Associate III
December 28, 2019

AC couple channel, gnd to gnd and probe x10 to OSC pin. If triggering this signal is imppssible (but can catch it with single on scope, run stop) than probabbly crystal if faullty and frequency is fluid.

Beside checking base frequency now You can perform math functions if scope allows. Do FFT and check charmonics level.​

oeliks
Associate III
December 28, 2019

And You can also run a timer to blink led 1 s. Its easy to spot when your crystal HSE is not working and switch to lower freqency HSI.

S.Ma
Principal
December 28, 2019

if you are using a discovery board, check on the schematic that the pins are not connected to soldered components as they likely be.

You can first run the code with HSI 16 MHz internal clock (just don't inject clocks) to see what happens.

Then run a simple test main function

  • enable the peripheral clock
  • configure the GPIOs as push pull outputs (you can directly write the GPIO peripheral registers in 16 bit blocks)
  • use a main loop with delay to toggle these pins (use a global reference uint16_t mask myPort = 0, and use myPort ^= 0xFFFF to toggle, in order not to read the port to toggle it.
  • check pin by pin what you see.
T J
Senior III
December 29, 2019

dont wait,

did you prove the crystal is running, or did you select the onboard oscillator ?

which PCB are you using ?

Ala
AlaAuthor
Senior
December 29, 2019

GUYS IT IS SOOOOOLVED!

THANKS everyone who helped me through! :folded_hands: :folded_hands: :folded_hands:

T J
Senior III
December 29, 2019

good to hear,

my approach is one step at a time, prove the board first.

but you didn't answer most of the questions, how can we do better than that ?

good work,