Giter VIP home page Giter VIP logo

arduino-for-keil's Issues

调试IIC时,初始化出不来,

void TwoWire::set_scl(bool state)
{
I2C_DELAY(this->i2c_delay);
digitalWrite(this->scl_pin, state);
//Allow for clock stretching - dangerous currently
if (state == HIGH)
{
while(digitalRead(this->scl_pin) == 0);
}
}

卡在了 while里面 请问这个 while有什么作用

Keil5不能引用Arduino库中的Class

*** Using Compiler '', folder: 'D:\Kil_v5\ARM\ARMCC\bin'
Build target 'Project'
compiling main.cpp...
..\USER\main.cpp(12): error: #289: no instance of constructor "HardwareSerial::HardwareSerial" matches the argument list
argument types are: (Pin_Type, Pin_Type)
HardwareSerial PB(PA10,PA9);

STM32F103RC移植报错

大佬们,我在STM32F10X的工程中更换了芯片STM32F103RC,这是为了能够在proteus中进行仿真。但是直接这样报错了,我参考野火的例程,应该要更换启动文件为ld.s,但是我直接添加进去还是有错,然后我又想着把ArduinoAPI和内核移植到野火的例程中,还是错误。想知道怎么更换芯片能够不报错啊!

millis()多线程运行时间不对

我用millis()多线程运行时间,发现运行millis()时间不对,慢的很多。
const int ledPin = PC13; // the LED pin number connected
int ledState = LOW; // used to set the LED state
unsigned long previousMillis = 0; //will store last time LED was blinked
const long period = 300;
unsigned long currentMillis = millis(); // store the current time

pinMode(PC13, OUTPUT);

if (currentMillis - previousMillis >= period) { // check if 1000ms passed
previousMillis = currentMillis; // save the last time you blinked the LED
if (ledState == LOW) { // if the LED is off turn it on and vice-versa
ledState = HIGH;
} else {
ledState = LOW;
}
digitalWrite(ledPin, ledState);//set LED with ledState to blink again
}

上面是我的代码,其中const long period = 300; 这个原来是1000ms,我发现PC13 的led灯闪烁间隔有7秒的间隔,改了300ms还是7秒左右,是不是我写的有问题?你有这个millis()的测试代码吗?
谢谢了 又问了你一个问题 麻烦了

移植库文件报错

linking...
.\Objects\proj.axf: Error: L6218E: Undefined symbol Adafruit_MS_PWMServoDriver::setPWMFreq(float) (referred from qgpmaker_motorshield.o).
.\Objects\proj.axf: Error: L6218E: Undefined symbol Adafruit_MS_PWMServoDriver::begin() (referred from qgpmaker_motorshield.o).
.\Objects\proj.axf: Error: L6218E: Undefined symbol Adafruit_MS_PWMServoDriver::setPWM(unsigned char, unsigned short, unsigned short) (referred from qgpmaker_motorshield.o).
.\Objects\proj.axf: Error: L6218E: Undefined symbol Adafruit_MS_PWMServoDriver::Adafruit_MS_PWMServoDriver(unsigned char) (referred from qgpmaker_motorshield.o).
Not enough information to list image symbols.
Finished: 1 information, 0 warning and 4 error messages.

Adafruit_SSD1306 例子报错

先谢谢大佬的开源,我尝试编译了一下oled的库,有点小问题
Compiler:ac5
IDE:KEIL v5.27pre
错误信息:
..\Libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp(184): error: #513: a value of type "volatile std::uint32_t *" cannot be assigned to an entity of type "PortReg *"
解决方法:
添加强制类型转换 (PortReg *)

        csport      = (PortReg*)portOutputRegister(digitalPinToPort(cs));
        cspinmask   = digitalPinToBitMask(cs);
        dcport      = (PortReg*)portOutputRegister(digitalPinToPort(dc));
        dcpinmask   = digitalPinToBitMask(dc);

sd卡读写问题

用stm32f103c8t6核心板。sd卡库编译通过,但是连不上sd卡。用stm32的spi引脚(PA4 CS, 5 SCK, 6 MISO, 7 MOSI)。我用stlink调试得到卡在了SdVolume的init初始化上,前一步card.init可以。想得到大佬的帮助。

Print.h和Printable.h报错

我在使用其他.c文件加载#include "FileGroup.h",这个FileGroup.h前面有×,无法build,显示..\ArduinoAPI\Printable.h(25): error: #20: identifier "class" is undefined,..\ArduinoAPI\Print.h(101): error: #169: expected a declaration。我是初学者,在这麻烦你解决下,谢谢,最近下载的文件,是最新的。使用main.cpp,build是没有问题的,就是其他的.c文件加头文件include "FileGroup.h"build出错

[user contribution] Libraries - Tested

@FASTSHIFT
I want to share the libraries I use and that I tested with the real hardware.

My setup: SMT32F030 with internal clock @8MHz

I use this libraries, sensors and displays in other arduino projects and I want to share it.
All this libraries are working, I did changes in some of them in order to work correctly, also I added the examples as I use in Keil.

List:
Sensors
BMP085 Adafruit_BMP085
BME280 Grove_-_Barometer_Sensor_BME280
SHT31 Adafruit_SHT31

Display
OLED SSD1306 Adafruit_SSD1306_extra (note, this is a mod from the original library to support the 64x48 screen)
& also need the Adafruit_GFX_Library (attached here too).
PCD8544 (Nokia 3310) pcd8544 (not adafruit, this is a lightweight alternative, easy to use).

Wireless
RFM69 RFM69_LowPowerLab.

Others
JSON jWrite (to make JSON format data)

pcd8544.zip
RFM69_LowPowerLab.zip
Adafruit_BMP085_Library.zip
Adafruit_GFX_Library.zip
Adafruit_SHT31_Library.zip
Adafruit_SSD1306_extra.zip
Grove_-_Barometer_Sensor_BME280.zip
jWrite.zip

Low Power Mode [Help nedeed]

Hello.

I have been for a while diving in information and looking in the internet before coming to ask.

I am testing out the Low Power Modes in the STM32F03F4P6, at this point I have been able to use the STOPMode and wake-up with a pin Interrupt, in my custom PCB the power goes low to 10uA, really good.

But I want to know how to make it awake every certain amount of time then sleep again, for example to read a sensor, send the data then sleep some minutes and do it again.

I have been trying using the Timer example, not success there. Probably I am missing something important. I read something about this line of code NVIC_SystemLPConfig(NVIC_LP_SLEEPONEXIT, ENABLE); but I really cannot understand the process to follow, if someone can point me in the right direction it will be great.

This is the code I have been trying unsuccessfully.

` #include "Arduino.h"

#define LED_Pin PA4
#define KEY_Pin PA1

void Timer1_Callback(){
pinMode(LED_Pin, OUTPUT);
togglePin(LED_Pin);
TIM_Cmd(TIM1, DISABLE);
InternalClocks_Init(); //Setup the clock after awake
}

void enterStopMode(){
Timer_SetInterrupt(TIM1, 1000000/@1s/, Timer1_Callback);
TIM_Cmd(TIM1, ENABLE);

//I dont know what the below line does but decrease the power by 10uA
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); //Turn on the power management clock

//Set the Regulator in Low Power and can be awake by an interrupt
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
}

//Set Pins to Analog to decrease power usage
void setPinsToAnalog(){
pinMode(PA0, INPUT_ANALOG);
pinMode(PA1, INPUT_ANALOG); //If set to analog Interrupt do not work
pinMode(PA2, INPUT_ANALOG);
pinMode(PA3, INPUT_ANALOG);
pinMode(PA4, INPUT_ANALOG);
pinMode(PA5, INPUT_ANALOG);
pinMode(PA6, INPUT_ANALOG);
pinMode(PA7, INPUT_ANALOG);
pinMode(PA9, INPUT_ANALOG);
pinMode(PA10, INPUT_ANALOG);
pinMode(PB1, INPUT_ANALOG);
pinMode(PF0, INPUT_ANALOG);
pinMode(PF1, INPUT_ANALOG);
}

void setup(){
pinMode(LED_Pin, OUTPUT);
pinMode(KEY_Pin, INPUT_PULLDOWN);

// it is supposed to allow to wakeup with the time but it did not work.
NVIC_SystemLPConfig(NVIC_LP_SEVONPEND, ENABLE);
}

void loop(){
//Just Keep the LED On to measure the running power
digitalWrite(LED_Pin, HIGH);
delay(5000);
digitalWrite(LED_Pin, LOW);

//Go to Sleep
setPinsToAnalog();
enterStopMode();
}

/**

int main(void)
{
InternalClocks_Init(); //Set the internal clock @ 8MHz
Delay_Init();
setup();
for(;;)loop();
} `

加载extEEPROM编译错误

在当前更新空模板上,项目只加载extEEPROM库后预编译提示11个错误,错误信息
compiling extEEPROM.cpp...
..\ArduinoAPI\WString.h(174): error: #338: more than one instance of overloaded function "operator+" has "C" linkage
friend StringSumHelper & operator + (const StringSumHelper &lhs, const char *cstr);
..\ArduinoAPI\WString.h(175): error: #338: more than one instance of overloaded function "operator+" has "C" linkage
friend StringSumHelper & operator + (const StringSumHelper &lhs, char c);
..\ArduinoAPI\WString.h(176): error: #338: more than one instance of overloaded function "operator+" has "C" linkage
friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned char num);
..\ArduinoAPI\WString.h(177): error: #338: more than one instance of overloaded function "operator+" has "C" linkage
friend StringSumHelper & operator + (const StringSumHelper &lhs, int num);
..\ArduinoAPI\WString.h(178): error: #338: more than one instance of overloaded function "operator+" has "C" linkage
friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned int num);
..\ArduinoAPI\WString.h(179): error: #338: more than one instance of overloaded function "operator+" has "C" linkage
friend StringSumHelper & operator + (const StringSumHelper &lhs, long num);
..\ArduinoAPI\WString.h(180): error: #338: more than one instance of overloaded function "operator+" has "C" linkage
friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num);
..\ArduinoAPI\WString.h(181): error: #338: more than one instance of overloaded function "operator+" has "C" linkage
friend StringSumHelper & operator + (const StringSumHelper &lhs, float num);
..\ArduinoAPI\WString.h(182): error: #338: more than one instance of overloaded function "operator+" has "C" linkage
friend StringSumHelper & operator + (const StringSumHelper &lhs, double num);
..\ArduinoAPI\WString.h(183): error: #338: more than one instance of overloaded function "operator+" has "C" linkage
friend StringSumHelper & operator + (const StringSumHelper &lhs, const __FlashStringHelper *rhs);
..\ArduinoAPI\Print.h(100): error: #800: this declaration may not have extern "C" linkage
template inline Print &operator << (Print &obj, T arg) {
..\Libraries\extEEPROM\extEEPROM.cpp: 0 warnings, 11 errors
compiling Tone.cpp...
compiling adc.c...
compiling delay.c...
assembling startup_stm32f10x_md.s...
compiling exti.c...
compiling gpio.c...
compiling pwm.c...
compiling timer.c...
compiling main.cpp...
compiling system_stm32f10x.c...
compiling misc.c...
compiling stm32f10x_adc.c...
compiling stm32f10x_dma.c...
compiling stm32f10x_exti.c...
compiling stm32f10x_flash.c...
compiling stm32f10x_gpio.c...
compiling stm32f10x_rcc.c...
compiling stm32f10x_spi.c...
compiling stm32f10x_usart.c...
compiling stm32f10x_tim.c...
"..\OBJ\Pro.axf" - 11 Error(s), 0 Warning(s).
Target not created.

在上个更新模板下加载extEEPROM过是正常编译的。

[Help wanted] I2C problem

Hello FASTSHIFT.

I am a hobbyist of Arduino and recently discovered your job and I have been playing with it for 2 or 3 days, I blinked a LED, fade in and out and printed to serial using your examples, so far, so good.

I bought some months ago a board with STM32F030F4P6 (SSOP-20 package), really cheap and I have been working to move some of attiny84 projects to this MCU, not luck with it, code was too big until I found your project.

Now I am trying to Port some of the Arduino libraries for my sensors and screens, many of them are I2C (BMP085, BME280, OLED SSD1306...) So first I tried to use the I2C scanner code from the Arduino community but seems it hangs up the whole thing and don't even get serial Port outputs.

I will be very happy if you can help me on it.

This is the code:


/I2C Scanner
//#define pinSDA PA1
//#define pinSCL PA2
#define SDA_Pin PA1
#define SCL_Pin PA2
 
#include <Wire.h>
//TwoWire Wire(pinSCL, pinSDA, SOFT_FAST);
 
void Serial_EventHandler()
{
    togglePin(LED_Pin);
}
 
void setup()
{
  Wire.begin();
  Serial.begin(9600);
                //Serial.setTimeout(10);
  //Serial.attachInterrupt(Serial_EventHandler);
  Serial.println("\nI2C Scanner");
}
 
 
void loop()
{
  byte error, address;
  int nDevices;
 
  Serial.println("Scanning...");
 
  nDevices = 0;
  for(address = 1; address < 127; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
 
    if (error == 0)
    {
      Serial.printf("I2C device found at address 0x");
      if (address<16)
        Serial.printf("0");
      Serial.print(address,HEX);
      Serial.println("  !");
 
      nDevices++;
    }
    else if (error==4)
    {
      Serial.printf("Unknow error at address 0x");
      if (address<16)
        Serial.printf("0");
      Serial.println(address,HEX);
    }   
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");
 
  delay(5000);           // wait 5 seconds for next scan
}
 
int main(void)
{
    Delay_Init();
    setup();
    for(;;)loop();
} 

This is my board:
By the way, the code use the internal oscillator or external?

image

image

Servo库频率错误

您好
首先感谢大神做出的辛勤劳动,这样的项目意义重大,昨天下载下来后捣鼓一下就成功了

首先报告我用的是STM32F407VET6,代码很简单,就是用的Servo库例程
我在实验Servo库时,按顺序实验了TIM1~TIM5 挂接的管脚,发现除了使用TIM1 `时的频率与占空比是正确的(50HZ)
见图(TIM1,PA10):
微信图片_20190508130204

使用TIM 2,3挂接的管脚都出现了占空比正确,但频率不对的问题(25HZ)
见图(TIM2,PA0)
微信图片_20190508130759

Some ERROR in Print.h..

..\Libs\ArduinoAPI\Printable.h(25): error: #20: identifier "class" is undefined
..\Libs\ArduinoAPI\Printable.h(34): error: #65: expected a ";"
..\Libs\ArduinoAPI\Print.h(66): error: #147-D: declaration is incompatible with "size_t println(const char *)" (declared at line 65)
..\Libs\ArduinoAPI\Print.h(67): error: #147-D: declaration is incompatible with "size_t println(uint8, int)" (declared at line 65)
..........

移植到其他平台问题

请问大佬如果说我将Arduino这个框架移植到N32G45X(ARM-Coterx-M4)是不是同样适用?

按照教程移植,但是导入库失败

教程如下
https://blog.csdn.net/m0_50926303/article/details/120585496
下方为错误信息
Build started: Project: proj
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'Project'
compiling SPFD5408_Adafruit_GFX.cpp...
..\Libraries\SPFD5408-master\SPFD5408_Adafruit_GFX.cpp(37): error: #5: cannot open source input file "SPFD5408_Adafruit_GFX.h": No such file or directory
#include <SPFD5408_Adafruit_GFX.h>
..\Libraries\SPFD5408-master\SPFD5408_Adafruit_GFX.cpp: 0 warnings, 1 error
compiling SPFD5408_TouchScreen.cpp...
..\Libraries\SPFD5408-master\SPFD5408_TouchScreen.cpp(6): error: #5: cannot open source input file "pins_arduino.h": No such file or directory
#include "pins_arduino.h"
..\Libraries\SPFD5408-master\SPFD5408_TouchScreen.cpp: 0 warnings, 1 error
compiling SPFD5408_Adafruit_TFTLCD.cpp...
..\Libraries\SPFD5408-master\SPFD5408_Adafruit_TFTLCD.h(18): error: #5: cannot open source input file "SPFD5408_Adafruit_GFX.h": No such file or directory
#include <SPFD5408_Adafruit_GFX.h>
..\Libraries\SPFD5408-master\SPFD5408_Adafruit_TFTLCD.cpp: 0 warnings, 1 error
".\Objects\proj.axf" - 3 Error(s), 0 Warning(s).
Target not created.

重映射问题

引脚重映射还是只能用标准库, f103定时器定义太少 发f103zg有8个定时器 但是只定义4个

使用F401RC仿真运行,为什么不停的复位?

修改为F401RC的改动:

  1. C/C++ 修改宏为:STM32F401xx
  2. ARM Compiler: 选择使用 version5 和 version6 编译仿真都会复位。
  3. Device:选择为STM32F401RC
  4. 使用的是:Keil.STM32F4xx_DFP.2.15.0.pack 修改为Keil.STM32F4xx_DFP.1.0.8.pack编译仿真也会复位。
  5. 代码修改晶振8M #define PLL_M 8
  6. 代码编译使用Startup下面的startup_stm32f401xx.s
  7. 屏蔽编译错误,禁止编译stm32f4xx_fsmc.c
  8. 屏蔽编译错误,屏蔽 TIMx_IRQn_DEF(8, TIM8_UP_TIM13_IRQn); TIMx_IRQn_DEF(12, TIM8_BRK_TIM12_IRQn);
    TIMx_IRQn_DEF(13, TIM8_UP_TIM13_IRQn); TIMx_IRQn_DEF(14, TIM8_TRG_COM_TIM14_IRQn);
    9.测试使用的是空应用:
    void setup() {
    // put your setup code here, to run once:
    }
    void loop() {
    // put your main code here, to run repeatedly:
    }
    int main(void)
    {
    NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
    Delay_Init();
    //ADCx_Init(ADC1);
    setup();
    for(;;)loop();
    }

18b20、31865、热敏打印机库

大佬 你好
我在移植一个Arduino工程,需要用到18b20、31865、热敏打印机库等库,麻烦大佬给适配一下。谢谢

膜拜大佬

跟随大佬从arduino贴吧到QQ空间再到此

_Keilduino (STM32F4xx)打开Keil,报错。

错误如下:Device下各个组件为红色报错
Warning #440: Requested device 'STM32F407VE' is subsituted with variant 'STM32F407VETx' for target 'Project'
Error instantiating RTE components
Error #540: 'Keil::Device:StdPeriph Drivers:ADC:1.3.0' component is not available for target 'Project', pack 'Keil.STM32F4xx_DFP.1.0.8' is not selected
Error #540: 'Keil::Device:StdPeriph Drivers:DCMI:1.3.0' component is not available for target 'Project', pack 'Keil.STM32F4xx_DFP.1.0.8' is not selected
Error #540: 'Keil::Device:StdPeriph Drivers:DMA:1.3.0' component is not available for target 'Project', pack 'Keil.STM32F4xx_DFP.1.0.8' is not selected
Error #540: 'Keil::Device:StdPeriph Drivers:EXTI:1.3.0' component is not available for target 'Project', pack 'Keil.STM32F4xx_DFP.1.0.8' is not selected
Error #540: 'Keil::Device:StdPeriph Drivers:Flash:1.3.0' component is not available for target 'Project', pack 'Keil.STM32F4xx_DFP.1.0.8' is not selected
Error #540: 'Keil::Device:StdPeriph Drivers:Framework:1.3.1' component is not available for target 'Project', pack 'Keil.STM32F4xx_DFP.1.0.8' is not selected
Error #540: 'Keil::Device:StdPeriph Drivers:GPIO:1.3.0' component is not available for target 'Project', pack 'Keil.STM32F4xx_DFP.1.0.8' is not selected
Error #540: 'Keil::Device:StdPeriph Drivers:I2C:1.3.0' component is not available for target 'Project', pack 'Keil.STM32F4xx_DFP.1.0.8' is not selected
Error #540: 'Keil::Device:StdPeriph Drivers:RCC:1.3.0' component is not available for target 'Project', pack 'Keil.STM32F4xx_DFP.1.0.8' is not selected
Error #540: 'Keil::Device:StdPeriph Drivers:SPI:1.3.0' component is not available for target 'Project', pack 'Keil.STM32F4xx_DFP.1.0.8' is not selected
Error #540: 'Keil::Device:StdPeriph Drivers:SYSCFG:1.3.0' component is not available for target 'Project', pack 'Keil.STM32F4xx_DFP.1.0.8' is not selected
Error #540: 'Keil::Device:StdPeriph Drivers:TIM:1.3.0' component is not available for target 'Project', pack 'Keil.STM32F4xx_DFP.1.0.8' is not selected
Error #540: 'Keil::Device:StdPeriph Drivers:USART:1.3.0' component is not available for target 'Project', pack 'Keil.STM32F4xx_DFP.1.0.8' is not selected

关于MPU6050_DMP的问题

作者你好,在加入MPU6050_DMP库,使用示例时#include "MPU6050_6Axis_MotionApps20.h"报错,问题:error in include chain (helper_3dmath.h):call to 'sqrt' is ambiguous.
(头文件已包含)
请问是什么原因造成。

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.