mnd / libstm8 Goto Github PK
View Code? Open in Web Editor NEWLibrary for STM8 microcontroller
License: GNU General Public License v3.0
Library for STM8 microcontroller
License: GNU General Public License v3.0
In lib/l/Makefile line 9, "sdcclib" is used to generate the .lib file. However, it's been deprecated and replaced with "sdar -rc".
Line 9 should be:
sdar -rc ../stm8.lib $(OBJECTS)
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 the right way.
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.๐
`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);
}`
I was looking to fork / improve this code, and extend it for use with other micros in the STM8 family, but this project is currently licensed GPL.
As such. any use of this code in a project will require licensing of any and all other code to be GPL to be compliant. This is fine for hobbyist or personal use, but for actual embedded product development this should not be a forced decision. Also, this is a library, and the GPL is a poor license choice for libraries (unless, of course, the goal is to further push GPL).
The library you wish to emulate, libopencm3, is LGPL. That is also problematic for embedded software as libraries usually aren't linked, though they have shown interest in adding a linking exception.
Is there any reason this project is licensed GPL, and if none in particular, could it be relicensed to something either more liberal (MIT, BSD, etc) or something more embedded-friendly?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.