cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L053 Discovery Kit (UART between PC and Kit)

mark_ko
Associate II
Posted on March 06, 2015 at 09:32

Hi, i am very new to STM32, just installed the IAR environment. Appreciate if anyone could advise.

Is there a UART example of String transfer using UART TX/RX of PA9 and PA10 in Polling mode  for STM32L053 Discovery Kit (Between PC and Kit) ?

Thanks
29 REPLIES 29
Posted on May 13, 2015 at 18:30

You said in your first post in this thread:

> I have successfuly connected the stm32 pins PA9 and PA10 and with a FTDI Chip with a RS-232 Femal on my PC.

> I test this connection with the HTERM.

Now what is exactly your problem? You don't know how to store incoming bytes in an array?

JW

Posted on May 13, 2015 at 18:35

You'd accumulate the data one byte at a time and process it once you'd reach some specified limit, or some line termination (CR, LF, etc)

See the NMEA cites earlier.

I'm not using L0 or Cube, but receiving bytes from a USART should be materially the same across all variants of Cube (this the selling point as I understand it), and quite similar for most all library and microprocessor combinations.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
philipp23
Associate II
Posted on May 14, 2015 at 22:10

Yes, I want to receive and store incomming bytes in an array and to display the content of the array on the e paper.

Thanks

Posted on May 14, 2015 at 22:58

In pseudocode:

#include <stdint.h>
#define MAX_S_LEN 16
char
s[MAX_S_LEN + 1];
uint_least8_t sPos;
int
main(
void
) {
[initialization code]
sPos = 0;
while
(1) {
if
(uart_receiver_signals_byte_arrival()) {
uint8_t c;
c = uart_pick_byte();
if
(sPos < MAX_S_LEN) { 
// prevent buffer overflow, throw away excess
s[sPos] = (
char
)c;
sPos++;
}
if
(c == 0x0D) { 
// enter arrived
s[sPos] = 
'\0'
;
print_to_epaper(s);
sPos = 0;
}
}
}
}

JW
Posted on May 15, 2015 at 01:32

Yes, I want to receive and store incoming bytes in an array and to display the content of the array on the e paper.

Ok, do you have some prior programming experience you can leverage here?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
philipp23
Associate II
Posted on May 15, 2015 at 08:59

Thanks for the pseude code.

int main(void)

{

  HAL_Init();

 

  /* Configure LED3 */

  BSP_LED_Init(LED3);

    BSP_LED_Init(LED4);

    

    BSP_EPD_Init();

  SystemClock_Config();

    

  UartHandle.Instance        = USARTx;

  UartHandle.Init.BaudRate   = 9600;

  UartHandle.Init.WordLength = UART_WORDLENGTH_8B;

  UartHandle.Init.StopBits   = UART_STOPBITS_1;

  UartHandle.Init.Parity     = UART_PARITY_NONE;

  UartHandle.Init.HwFlowCtl  = UART_HWCONTROL_NONE;

  UartHandle.Init.Mode       = UART_MODE_TX_RX;

 

  if(HAL_UART_Init(&UartHandle) != HAL_OK)

  {

    Error_Handler();

  }

    

    BSP_EPD_DrawImage(0, 0, 72, 172, (uint8_t*) picture_2);

    BSP_EPD_RefreshDisplay();

    HAL_Delay(500);

This is what i have.

Thanks a lot

philipp23
Associate II
Posted on May 18, 2015 at 10:31

Can you help me?

Posted on May 18, 2015 at 17:53

Can you help me?

I need some help painting my fence and mowing my grass.

I think the answer is no, I can suggest things you can do or review, but I'm not coding your project.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
philipp23
Associate II
Posted on May 26, 2015 at 10:37

Hi,

I have some question about the display size.

In the paper of stm32l053 the display size is mentioned in 172x72.

This size is for a sized picture with 172x72 pixel, but is it also valid for hex?

When I send a hex to my display, how must the display be configured?

My code of the display configuration:

BSP_EPD_DrawImage(0,0,73,119, hextoreceive);

            BSP_EPD_RefreshDisplay();

            BSP_EPD_Clear(EPD_COLOR_WHITE);

            HAL_Delay(10);

philipp23
Associate II
Posted on June 16, 2015 at 09:15

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6pF&d=%2Fa%2F0X0000000bwH%2Fy0jplKGM6NdiGHzzsdpNrqLnbNrQFJ8IFdSmcTiDzO0&asPdf=false