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?


 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs