Hello, welcome to our forum.

It looks like you have registered but you have not yet posted and messages. Our requirements are that you must post at least two messages, to allow the moderators to review your registration, before you will be allowed access to the full range of forum areas.

Please make a couple of posts, until then you may see a notice that says you are banned from certain forum areas.


Thank you.

Remove Text Formatting
Loading...

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2016
    Posts
    3

    Default STM32F031K6 HAL UART Interrupts problem

    Name:  TlxSa.png
Views: 205
Size:  123.2 KB
    I got a new STM32F031K6 nucleo board and I need to make a GSM UART interface on that board. I need to send an AT and receive an OK from the GSM board as a first step.I am able to transmit AT successfully But cannot receive anything. I am using IAR. I am using PA9 - TX and PA10 - RX. How to create a transmit and receive code using interrupts using this HAL library. I wrote code using interrupts and it's not giving a single character.
    This is my code


    int main(void){ HAL_Init();/* Configure the system clock to 48 MHz */SystemClock_Config();/* Configure LED3 */ BSP_LED_Init(LED3); UART_Init(); BSP_LED_Off(LED3);if(HAL_UART_Transmit(&UartHandle,(uint8_t*)aTxBuffer, TXBUFFERSIZE,100)!= HAL_OK){Error_Handler();}if(HAL_UART_Receive_IT(&UartHandle,(uint8_t*)aRxBuffer,6)!= HAL_OK){Error_Handler();}/*##-5- Wait for the end of the transfer ###################################*/while(UartReady!= SET){}/* Reset transmission flag */UartReady= RESET;/*if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aRxBuffer, 6,1000)!= HAL_OK) { Error_Handler(); }*/while(1){}}
    IRQ handler


    voidUSARTx_IRQHandler(void){ HAL_UART_IRQHandler(&UartHandle);}

    Receive callback function

    void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle){if(UartHandle->Instance==USARTx){/* Set transmission flag: transfer complete */UartReady= SET; BSP_LED_On(LED3);}}

    And when I am debugging the code stuck at this point .

    /*##-5- Wait for the end of the transfer ###################################*/while(UartReady!= SET){}

    My actual application is to send an SMS to the GSM board using UART and collect the reply in a buffer and then parse it.First i need to make this interface And I cannot use DMA as there is no idea on how much data is received on this commuunication.
    please help guys..

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,215

    Default Re: STM32F031K6 HAL UART Interrupts problem

    Looks like C.

    This is a PIC Basic forum. You "might" be lucky and get help.

    Robert
    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. UART communication problem
    By picmilan in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 27th September 2016, 03:51
  2. Replies: 9
    Last Post: - 1st June 2016, 06:04
  3. uart problem
    By OYMYAKON in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th March 2011, 11:52
  4. Problem using Microloader and Uart Comm at the same time
    By guanerrr in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 3rd August 2007, 09:31
  5. Problem with UART... here is a real challenge
    By matias in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 5th May 2007, 08:30

Members who have read this thread : 17

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts