2024-07-10 03:46 AM
Hello everyone, I am working on a project using nanoedge studio ia in rating N, I want to check my project with cube ide, I can make a view with tera term or other tool, which shows the result corresponding to my database. I used stm32L475vgt6; The problem is that there is also no display with a simple code that says printf(hello World)
2024-07-10 05:18 AM
Hello Ismail,
I didn't understand your question.
Can you explain me what is the "println(hello World")" you are talking about?
You can use screenshot if you need to.
Have a good day,
Julian
2024-07-10 05:32 AM
after i finished all steps of nanoedge . now i want to do this project in stm cube ide . i want the result displays in tera term . but there is no result appear in tera term so i make a simple code to testing . but no result also . now i want to make a led to light up when the result is diabetes and light off when non_diabetes .. to undrsatnd me . the dataset i used in nanoedge is a dataset for daibetes . so it's 1 if daibetes else 0
2024-07-10 05:39 AM
/* Includes */
#include "main.h"
#include "NanoEdgeAI.h"
#include "knowledge.h"
#include "stm32l4xx_hal.h"
#include <stdlib.h> // Include standard library for rand()
/* Private variables */
NEAI_StateTypeDef neai_state;
UART_HandleTypeDef huart4;
/* Private function prototypes */
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_UART4_Init(void);
float knowledge_buffer[50];
NEAI_StateTypeDef neai_state;
/* Main function */
int main(void) {
HAL_Init(); // Initialize HAL
SystemClock_Config(); // Configure the system clock
MX_GPIO_Init(); // Initialize GPIOs
MX_UART4_Init(); // Initialize UART if used
// Initialize NanoEdge AI
neai_state = neai_classification_init(knowledge_buffer);
if (neai_state != NEAI_OK) {
// Handle initialization error
while(1); // Halt here or handle as per your project's error handling strategy
}
// Main loop
while (1) {
float input_data[AXIS_NUMBER * DATA_INPUT_USER]; // Replace with actual sensor data acquisition
// Example: simulate sensor data acquisition
for (int i = 0; i < AXIS_NUMBER * DATA_INPUT_USER; i++) {
input_data[i] = (float)(rand() % 100); // Example data generation
}
float output_buffer[CLASS_NUMBER];
uint16_t id_class;
// Perform classification
neai_state = neai_classification(input_data, output_buffer, &id_class);
if (neai_state != NEAI_OK) {
// Handle classification error
continue; // Or handle as per your project's error handling strategy
}
// Determine LED status based on classification result
if (id_class == 1) {
// Diabetes detected, turn on LED
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET); // Adjust GPIO pin as per your setup
} else {
// No diabetes detected, turn off LED
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET); // Adjust GPIO pin as per your setup
}
HAL_Delay(1000); // Adjust delay as necessary for your application
}
}
/* System Clock Configuration */
void SystemClock_Config(void) {
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
// Configure the main internal regulator output voltage
if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) {
Error_Handler();
}
// Initialize the RCC Oscillators according to the specified parameters
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
RCC_OscInitStruct.MSICalibrationValue = 0;
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
Error_Handler();
}
// Initialize the CPU, AHB and APB buses clocks
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) {
Error_Handler();
}
}
/* GPIO Initialization */
void MX_GPIO_Init(void) {
GPIO_InitTypeDef GPIO_InitStruct = {0};
// GPIO Ports Clock Enable
__HAL_RCC_GPIOA_CLK_ENABLE(); // Adjust as per your GPIO port
// Configure GPIO pin : PA5 (example pin)
GPIO_InitStruct.Pin = GPIO_PIN_5; // Adjust GPIO pin as per your setup
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
/* UART4 Initialization */
void MX_UART4_Init(void) {
huart4.Instance = UART4;
huart4.Init.BaudRate = 115200;
huart4.Init.WordLength = UART_WORDLENGTH_8B;
huart4.Init.StopBits = UART_STOPBITS_1;
huart4.Init.Parity = UART_PARITY_NONE;
huart4.Init.Mode = UART_MODE_TX_RX;
huart4.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart4.Init.OverSampling = UART_OVERSAMPLING_16;
huart4.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart4.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart4) != HAL_OK) {
Error_Handler();
}
}
/* Error Handler */
void Error_Handler(void) {
while (1) {
// Handle error
}
}
/* assert_failed function */
void assert_failed(uint8_t *file, uint32_t line) {
// Handle assertion failed
}
2024-07-10 05:41 AM
this is my errors
13:37:05 **** Incremental Build of configuration Debug for project emchi_jed_bouk ****
make -j4 all
arm-none-eabi-gcc "../Core/Src/main.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32L475xx -c -I../Core/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Core/Src/main.d" -MT"Core/Src/main.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/main.o"
../Core/Src/main.c:24:16: error: expected identifier or '(' before '=' token
24 | enum neai_state=neai_classification_init();
| ^
../Core/Src/main.c:35:1: error: unknown type name 'NEAI_StateTypeDef'; did you mean 'HAL_StatusTypeDef'?
35 | NEAI_StateTypeDef neai_state;
| ^~~~~~~~~~~~~~~~~
| HAL_StatusTypeDef
../Core/Src/main.c:35:19: error: conflicting types for 'neai_state'; have 'int'
35 | NEAI_StateTypeDef neai_state;
| ^~~~~~~~~~
../Core/Src/main.c:26:19: note: previous declaration of 'neai_state' with type 'HAL_StatusTypeDef'
26 | HAL_StatusTypeDef neai_state;
| ^~~~~~~~~~
make: *** [Core/Src/subdir.mk:34: Core/Src/main.o] Error 1
"make -j4 all" terminated with exit code 2. Build might be incomplete.
13:37:06 Build Failed. 4 errors, 0 warnings. (took 1s.101ms)