Giter Site home page Giter Site logo

sdcc-examples-stm8's People

Contributors

vdudouyt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdcc-examples-stm8's Issues

build problem

Hello!

I try build this example with latest version of tools:
http://master.dl.sourceforge.net/project/sdcc/snapshot_builds/sdcc-src/sdcc-src-20140202-8938.tar.bz2
http://citylan.dl.sourceforge.net/project/hex2bin/hex2bin/Hex2bin-1.0.10.tar.bz2

but I have a build-error:

[doka@doka sdcc-examples-stm8]$ make
sdcc -mstm8 --out-fmt-ihx   blinky.c
hex2bin -p 00 blinky.ihx
hex2bin v1.0.10, Copyright (C) 2012 Jacques Pelletier & contributors

Lowest address  = 00008000
Highest address = 000080BF
Pad Byte        = 0
8-bit Checksum = BC
/opt/sdcc-3.3.2/bin/sdcc -mstm8 --out-fmt-ihx   uart.c

?ASlink-Warning-Undefined Global '_strlen' referenced by module 'uart'
make: *** [uart.ihx] Error 1
rm uart.ihx blinky.ihx
[doka@doka sdcc-examples-stm8]$ 

Also I try pass to sdcc arguments:

-I/opt/sdcc-3.3.2/share/sdcc/include -L/opt/sdcc-3.3.2/share/sdcc/lib/stm8

This is no changes.

What I doing wrong?

Best Regards,
Doka

STM8 UART Transmitting problem

Hello,

I am using the stm8l151... mcu and I am trying to send different strings via Uart1 to HTerminal. I have three different strings to send. The first two strings are transmitted completely but when the third one is being sent, it is truncated and it starts to send the first and second string again and repeatedly but when i go through the code step by step, it works normal.

I have attached the output from Hterm (uart_com) for better understanding and also some parts of my code(uart transmit and uart_init)

Just for better understanding of the attached output, the strings(cmd 1, 2 and 3) are at+nrb, at+cfun=1, and at+cops=1,2,"26201"

Please Any suggestion will be greatly appreciated.๐Ÿ˜Š

uart_com

`void nbiot_buf_transmit(void){
PAL_UART1_RX_DISABLE();
PAL_UART1_TX_ENABLE();

  for(int i=0 ; i < sizeof(cmd1);i++){
 
    
    USART_SendData8(USART1,((uint8_t)cmd1[i]));
   while(!(USART1->SR));
     while(USART_GetFlagStatus(USART1,USART_FLAG_TXE)==RESET);

}

for(int i=0 ; i < sizeof(cmd2);i++){

    USART_SendData8(USART1,((uint8_t)cmd2[i]));
       while(!(USART1->SR));
     while(USART_GetFlagStatus(USART1,USART_FLAG_TXE)==RESET);

}

for(int i=0 ; i < sizeof(cmd3);i++){

    USART_SendData8(USART1,((uint8_t)cmd3[i]));
        while(!(USART1->SR));
     while(USART_GetFlagStatus(USART1,USART_FLAG_TXE)==RESET);

}`

`void uart_init(void){
/* init Tx and Rx Pins /
GPIO_Init(GPIOC, GPIO_Pin_3, GPIO_Mode_Out_PP_High_Fast); //tx pin output
GPIO_Init(GPIOC, GPIO_Pin_2, GPIO_Mode_In_FL_No_IT); //rx pin input
/
enable usart1 clk /
(CLK->PCKENR1 |= (uint8_t)((uint8_t)1 << ((uint8_t)CLK_Peripheral_USART1 & (uint8_t)0x0F)));
/
config for GPIO mode */
(CLK->PCKENR2 |= (uint8_t)((uint8_t)1 << ((uint8_t)CLK_Peripheral_COMP & (uint8_t)0x0F)));
(RI->IOCMR3 &= 0xFD);
(RI->IOSR3 &= (uint8_t) (~(uint8_t) ((uint8_t)1 << (uint8_t) (RI_IOSwitch_6 & (uint8_t) 0x0F))));

(CLK->PCKENR2 &= (uint8_t)(~(uint8_t)(((uint8_t)1 << ((uint8_t)CLK_Peripheral_COMP & (uint8_t)0x0F)))));

/* init usart peripheral /
USART_Init(USART1,
(PAL_dwCLK_FREQ_VALUE/9600),
USART_WordLength_8b,
USART_StopBits_1,
USART_Parity_No,
USART_Mode_Rx); //Rx enable
ITC->ISPR8 &= 0xFC; // Set USART1_RX_IRQn on ITC_PriorityLevel_2
ITC->ISPR7 &= 0x3F; // Set USART1_TX_IRQn on ITC_PriorityLevel_2
/
enable usart1 peripheral */
USART_Cmd(USART1,ENABLE);

}`

[question] uart connection

Hello,
Sorry noob question.
Does uart example works with screen?
When I try out uart example I connect the controller with a usb uart device and the screen command

screen /dev/ttyUSB0 9600

It will send some data periodically with some delay as expected but all data were garbled.
I want to identify if it hardware or software issue so I want some confirmation that my software setup (screen) is correct.

PS. I use 16Mhz internal RC oscillator and already confirm the correctness of value in BRR1 and BRR2.

Caveat about memory layout

Continued from issue #2
When I investigate further.
I found that the code is misleading.
Here the issue

CLK_DIVR = 0x00; // Set the frequency to 16 MHz

When I read this line I perceive that master frequency is set to oscillator frequency but it actually is not.
Because memory offset of my device is different than the example.
Check page 34 of this reference.
Which is entirely different from your defined SFR
And since people who interested in this repo are mostly beginners just want to get started on stm8. Chance are they (me too) don't aware of the issue.

You'd better add some caveat about the SFR definition to the repo probably in the code comment.

No rule to make target 'sp_test.ihx'

sdcc -lstm8 -mstm8 --out-fmt-ihx blinky.c
sdcc -lstm8 -mstm8 --out-fmt-ihx uart.c
make: *** No rule to make target 'sp_test.ihx', needed by 'all'. Stop.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.