Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Trying to make a simple UART usage project, with interrupts

So i tried to build this little project, generated with STM32CubeMX.
The only line of codes i wrote were


void UART5_IRQHandler(void)
{
HAL_UART_Receive(&huart5,&box,3,500);
HAL_UART_Transmit(&huart5,&box,3,500);

}

where box is an extern uint8_t array of 3 elements.

When i try to build this unfortunately i get 2 errors on these 2 function calls. They both say ‘error: subscripted value is neither array nor pointer nor vector’.

Can somebody help me point out what i did wrong here?

Thanks in advance.

Hi,

CutPast from my code :

if(HAL_UART_Transmit(&UartHandleESP, (uint8_t*)aTxBuffer, strlen(aTxBuffer), 5000)!= HAL_OK)
{
Error_Handler();
}


if(HAL_UART_Receive(&UartHandleESP, (uint8_t *)aRxBuffer, 10, 5000) != HAL_OK)
{
Error_Handler();
}


with :
(should use malloc on definitive code)
uint8_t aTxBuffer100;
uint8_t aRxBuffer100;


France

Hi,

As, in C, the name of an array is in fact a pointer to its first element, in your code, the second parameter to HAL_UART_Receive/Transmit (which should be a pointer to a uint8_t) is a pointer to an array of uint8_t, which is in fact a pointer to a (litteral) pointer to an uint_t, so the error (which is quite informative, as it says that it can’t index the address of an array).

Here you should just pass box (and not &box).

Bernard (Ac6)

did what you told and, yep i probably didn’t think too much about that.
But now these weird errors popped out, see the screen attached.

How is it supposed to happen?