Comments (10)
My thoughts on this so far:
In I2C.c
: sendAddress(uint8_t i2cAddress)
:
is the third statement actually correct?
/* Test on EV5 and clear it */
while (!I2C_CheckEvent(I2C_EVENT_MASTER_MODE_SELECT));
/* Send the Address + Direction */
I2C->DR = i2cAddress; // I2C_Send7bitAddress()
/* Test on EV6 and clear it */
while (!I2C_CheckEvent(I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED));
Shouldn't we wait here for I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED
(in case we want to write)?
Wouldn't this mean we need two check the LSB in i2cAddress
to determine the right event to wait for, for this to be correct?
The doc in stm8s_i2c.h
states:
* Then the master has to wait that a slave acknowledges his address.
* If an acknowledge is sent on the bus, one of the following events will
* be set:
*
* 1) In case of Master Receiver (7-bit addressing):
* the I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED event is set.
*
* 2) In case of Master Transmitter (7-bit addressing):
* the I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED is set
Then in receiveByte
while (!I2C_CheckEvent(I2C_EVENT_MASTER_BYTE_RECEIVED));
// TODO: store I2C->DR in bytebuffer
// TODO: send 'ack/nack'
return 0;
...
from sduino.
You can assign this one to me. I just read a single byte from I2C..
from sduino.
I started a complete rewrite of I2C.c / I2C.h, as most of the functionality is handled by stm8s_i2c anyway...
I am reading the data fields (8 bytes) from a BME280 sensor and print the bytes to the OLED (poor man's debugging)...
I can create a pull request once you are happy with the changes. I'm not 100% happy yet, as there are possible lockups if slaves don't reply correctly, or are not answering at all 😱
from sduino.
Sounds good, thank you!
stm8s_i2c is part of the SPL. It is used sometimes for historic reasons, but my goal is to remove all dependencies and include it only as an optional library that could be used, if that seems to be useful for a project (because it might be ported to STM32 later).
For the core files (wiring.c, wiring_analog.c, HardwareSerial.c) I use a compiler flag USE_SPL to separate the parts requiring SPL and the stand-alone parts from each other. I think it would be helpful if you do something similar for i2c.
In general most spl function just test for one flag or do a simple register access. In most cases that is not really useful and can easily be replaced. But there are some exceptions. The uart initialization is a good example. It does useful calculations and it couldn't be done much simpler, so it might be more useful to avoid duplicating code and just stay with the spl function.
from sduino.
I tried to assign this one to you but it doesn't accept your username. Don't know why.
from sduino.
Good point. I will introduce the USE_SPL flag into the I2C library.
from sduino.
I tried to assign this one to you but it doesn't accept your username. Don't know why.
uvwxy ? awww 😔
For the core files (wiring.c, wiring_analog.c, HardwareSerial.c) I use a compiler flag USE_SPL to separate the parts requiring SPL and the stand-alone parts from each other. I think it would be helpful if you do something similar for i2c.
I'm not considering this as stable, but it works for me 🤓
from sduino.
I had to play around with the function names as I was getting warnings about duplicate global symbols. Do I have to remove them from the .lib files? Either way, I couldn't figure out how to exclude the stm8s_i2c.(c|h) as done with the uart(2|3|4) files...
Maybe you can help me out on this one?
from sduino.
I added an example for ADXL345, here.
Unfortunately I have not been very successful with the I2C on the stm8s103. I can read a few bytes here and but it is way too buggy to be useful. Also, writing to I2C crashes here and there so I'm not sure if I made things worse on my branch. 😅
from sduino.
Hi, I am new and I would like to try STM8S boards as well - already got me a couple to start with - the basic cheap ones - 2 under 1 USD :)
I have set up the JSON and installed the boards from the board manager - I have also tried the manual way but with no luck at all.
I have issues that every time I upload a sketch I get a warning about /tmp folder that needs to be created for the bash - I do have it and at the end, it uses it - I wonder why I am getting this error.
bash.exe: warning: could not find /tmp, please create!
I would be happy to learn more and help if needed :)
I am using Windows 8.1 and already have my ST-LINKV2 connected and working
I was able to upload only the blink sketch and I do want to be able to do more.
Main problem that I had is that I can not try any of the examples - it always says that I am missing something -
in Servo:
\AppData\Local\Arduino15\packages\sduino\hardware\stm8\0.3.3\libraries\Servo\src\stm8\Servo.c:24:22: fatal error: irqtable.h: No such file or directory
in oled-mini:
\AppData\Local\Arduino15\packages\sduino\hardware\stm8\0.3.3\libraries\I2C\I2C.c:398: error 20: Undefined identifier 'TWDR'
I wish I could use them for a small projects that I was hopeing to.
Please assist.
Thanks
from sduino.
Related Issues (20)
- Generic selection functional after SDCC 13402
- Is there possible software serial support?
- Compilation error when including .c file from the same directory
- Lack of example of using I2C. Event interrupts not implemented? HOT 5
- 'Upload using programmer' fails with "Error while uploading: missing 'program.params.verbose' configuration parameter" HOT 3
- Arduino IDE 2.0.3 gives "Error: 13 INTERNAL: Cannot install platform: installing platform" HOT 1
- Sleep and interrupt in Sduino HOT 2
- FAQ: Output high frequency PWM ?
- Cannot get PC5 to be high
- Package install error: searching package root dir: no unique root dir in archive HOT 3
- Connect ESP32 and ARDUINO UNO to remotely control servo motor via Wi-Fi
- board manager url problem HOT 2
- ESP8266(ESPDUINO-32) A programmer is required to upload
- Autofeeding(wifi control, stepper motor)
- Installing the Board in the Arduino is failing HOT 4
- Error while uploading: missing 'program.params.quiet' configuration parameter HOT 1
- STM8S103 Mini_SSD1306 text print
- TIMER 2 interrupts not working
- Mere presence of (even unused) function with PinName argument makes DigitalWriteFast slower 10x HOT 2
- DMX functionality
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sduino.