2024-05-13 01:00 PM - edited 2024-05-13 01:19 PM
Hello Gentlemen!
I have edited this question, former question below just for clarity.
New question: the ITM SWO printF-ing works with frequency of 4 MHz. I have searched every little PDF regarding my board (NUCLEO-U575ZI-Q) and i have no clue where you can find this number. Can anyone help me? The frequency in question is this one:
Former question (ignore)
I am just trying to make printF work over SWO. on my board, over STM32 IDE
Board number: NUCLEO-U575ZI-Q
Things i tried on the internet:
1. dont forget \n sign.
2. Make sure you have Solder bridge or whatever, to SWO: Internet provides lots of images of some table, where you have this SWO pin explicitely mentioned and said if its soldered or not. I never found this, but i did look at scheme, and everything related to SWO was present, no DNF
3. You have to have your CoreClock config synchronized: The only thing i found is in this image. I used both 16Mhz and 48 mhz, with no luck
Now, my config looks like this:
With ITM config like this:
and implementation of ITM function:
#define DEMCR *((volatile uint32_t*) 0xE000EDFCU)
#define ITM_STIMULUS_PORT0 *((volatile uint32_t*) 0xE0000000)
#define ITM_TRACE_EN *((volatile uint32_t*) 0xE0000E00)
void ITMSendChar(uint8_t ch){
DEMCR |= (1<<24);
ITM_TRACE_EN |= (1<<0);
while (!(ITM_STIMULUS_PORT0 & 1));
ITM_STIMULUS_PORT0 = ch;
}
#include <stdio.h>
#if !defined(__SOFT_FP__) && defined(__ARM_FP)
#warning "FPU is not initialized, but the project is compiling for an FPU. Please initialize the FPU before use."
#endif
int main(void)
{
printf("Hello \n");
/* Loop forever */
for(;;);
}
Am I missing something?
Solved! Go to Solution.
2024-05-13 02:44 PM - edited 2024-05-13 02:50 PM
This variable comes from the ARM CMSIS conventions. Any vendors' chip startup code must define SystemCoreClock and keep it in sync with every update of the core clock. ST libraries for CubeIDE use this convention and so do Keil and IAR. If your project lacks this... you live in a cave?
SystemCoreClockUpdate() is another CMSIS defined function that reads the core clock from hardware and updates SystemCoreClock. My bad, in previous reply I've meant SystemClock_Config(), not SystemClockConfig. That function is specific to the ST library.
2024-05-13 02:44 PM - edited 2024-05-13 02:45 PM
So assuming you're DIY'ing this and not using libraries
MCU will start and run from MSI at 4 MHz unless you change things
2024-05-13 02:52 PM
>>... you live in a cave?
Avoid the ones with bat guano, that s**t will make you crazy..
If one goes full-bare-metal it's probably not going to be there or needed. Not fully aware of the context here, but a quick grep of the source code, or github should illuminate.
2024-05-13 03:03 PM
My good sir, I'd gladly answer the cave name but i might have some street names mixed up.
Make no mistake; i have no idea what im doing so this very well might be (SOMEWHERE).
What i did:
1) Download STM32Cube IDE
2) clicked "new STM32 project"
3) picked my board from the list.
Thats it. All i got was this:
2024-05-13 03:05 PM
Thanks a lot. Already accepted your previous reply.
Im so new at this that i dont even know where a boundary of "DIY" is.
I clicked "generate new project" in STM32, it generated couple of random files, and thats all i got to ride with.