Please guide me
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-04-21 9:34 PM
I have stm32 board :
NUCLEO-L496ZG-P
and would like to make a simple helo word code in C and see out put by SWD debug connector in ITM unit (FIFO),
SO i create simple hello word as follow:
IDE : stm32cubeide
New > stm32 project > chose above board ,
main.c :
#include<stdio.h>
#include <stdint.h>
#include <stdint.h>
and
int main(void)
{
printf("Hello World\n");
/* Loop forever */
for(;;);
}
{
printf("Hello World\n");
/* Loop forever */
for(;;);
}
then add this code to syscalls.c as i found in internet :
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Implementation of printf like feature using ARM Cortex M3/M4/ ITM functionality
// This function will not work for ARM Cortex M0/M0+
// If you are using Cortex M0, then you can use semihosting feature of openOCD
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//Debug Exception and Monitor Control Register base address
#define DEMCR *((volatile uint32_t*) 0xE000EDFCU )
/* ITM register addresses */
#define ITM_STIMULUS_PORT0 *((volatile uint32_t*) 0xE0000000 )
#define ITM_TRACE_EN *((volatile uint32_t*) 0xE0000E00 )
void ITM_SendChar(uint8_t ch)
{
//Enable TRCENA
DEMCR |= ( 1 << 24);
//enable stimulus port 0
ITM_TRACE_EN |= ( 1 << 0);
// read FIFO status in bit [0]:
while(!(ITM_STIMULUS_PORT0 & 1));
//Write to ITM stimulus port0
ITM_STIMULUS_PORT0 = ch;
}
build and it work good,
connect board by mini usb to PC USB
and as I check window , it connect and working
finally try to debug but IDE give error message :
No ST-Link detected , Please connect ST-link and restart the debug session,
Please recommend if i miss some point ?
thank you in advance
Labels:
- Labels:
-
STM32CubeMX
-
STM32L4 series
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-04-21 9:52 PM - edited 2024-04-21 9:55 PM
Hello @CG3
Could you please try using an other USB port on your PC and ensure that you are using a USB data cable and not a charging cable. Finally, don't forget to check that all the steps of the part 3.1 of the UM2179 are verified.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
