Giter VIP home page Giter VIP logo

Comments (6)

geoffreymbrown avatar geoffreymbrown commented on June 27, 2024

it's defined in I2C.h

#ifndef I2C_H#define I2C_H #include <stm32f10x_i2c.h> typedef enum {Error =
0, Success = !Error } Status; Status I2C_Read(I2C_TypeDef* I2Cx, uint8_t*
buf, uint32_t nbuf, uint8_t SlaveAddress);Status I2C_Write(I2C_TypeDef* I2Cx
, const uint8_t* buf, uint32_t nbuf, uint8_t SlaveAddress);void
I2C_LowLevel_Init(I2C_TypeDef* I2Cx, int ClockSpeed, int OwnAddress); #endif

On Sat, Oct 4, 2014 at 9:20 AM, Stephan Goldenberg <[email protected]

wrote:

Hi,

I'm using Eclipse with gnuarm plugin http://gnuarmeclipse.sourceforge.net/,
trying to read BMP085 pressure sensors. Where is Status defined ? I'll try
uint32_t for now.

Have a nice weekend,
Stephan


Reply to this email directly or view it on GitHub
#4.

from stm32-template.

stehgold avatar stehgold commented on June 27, 2024

Ah, OK. This is not in the text I have.

from stm32-template.

stehgold avatar stehgold commented on June 27, 2024

Hmm, does not compile. It's choking on this 'Timed(x)' construct and doesn't seem to like lables.

Edit: Ooops, that was me. I forgot the lines '// Wait for stop' and on in I2C_Read(). Compiles now :)

13:49:36 **** Incremental Build of configuration Debug for project stm32vl_i2c ****
make all
Building file: ../src/i2c.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -Wextra -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_ITM -DSTM32F10X_MD_VL -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=8000000 -DTimed=1 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -MMD -MP -MF"src/i2c.d" -MT"src/i2c.o" -c -o "src/i2c.o" "../src/i2c.c"
In file included from ../src/i2c.c:8:0:
../src/i2c.h:18:0: warning: "Timed" redefined [enabled by default]
#define Timed(x) Timeout = 0xFFFF; while (x){if (Timeout-- == 0) goto errReturn;}
^
:0:0: note: this is the location of the previous definition
../src/i2c.c: In function 'I2C_Read':
../src/i2c.c:166:3: error: label 'errReturn' used but not defined
Timed(!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_BYTE_RECEIVED));
^
src/subdir.mk:24: recipe for target 'src/i2c.o' failed
make: *** [src/i2c.o] Error 1

from stm32-template.

stehgold avatar stehgold commented on June 27, 2024

Hmm, no errors, no warnings - not working. ;( Using an LA I can see START - 0xEE (SlaveAddress) - ACK - 0xAA (RegisterAddress) - ACK - STOP. Now 2 bytes should be read: I see START and nothing more (SDA and SCL stay low), the SlaveAddress gets never send. MCU is trapped in exit.c. Hardware is working fine with Tiva Launchpad.

from stm32-template.

geoffreymbrown avatar geoffreymbrown commented on June 27, 2024

I'm not sure I have enough info to help. When I get back home from
vacation in AZ next weekend I can send you a complete i2c application. At
the moment all I have is an ipad.

Geoffrey

On Tuesday, October 7, 2014, Stephan Goldenberg [email protected]
wrote:

Hmm, no errors, no warnings - not working. ;( Using an LA I can see START

  • 0xEE (SlaveAddress) - ACK - 0xAA (RegisterAddress) - ACK - STOP. Now 2
    bytes should be read: I see START and nothing more (SDA and SCL stay low),
    the SlaveAddress gets never send. MCU is trapped in exit.c. Hardware is
    working fine with Tiva Launchpad.


Reply to this email directly or view it on GitHub
#4 (comment)
.

from stm32-template.

stehgold avatar stehgold commented on June 27, 2024

Oooh, sorry. Enjoy your off time !

I got fishy and removed the Timed(... line after generate start and now anything is fine. MCU doesn't get trapped and I get sane values from the sensor. 26C, 989hPa - 1003hPa reported for my area. I don't know why waiting for I2C_EVENT_MASTER_MODE_SELECT fails.

Status I2C_Read(I2C_TypeDef* I2Cx, uint8_t* buf, uint32_t nbyte, uint8_t SlaveAddress){
__IO uint32_t Timeout = 0;
if (!nbyte) return Success;
// Wait for idle I2C interface
Timed(I2C_GetFlagStatus(I2Cx, I2C_FLAG_BUSY));
// Enable Acknowledgement, clear POS flag
I2C_AcknowledgeConfig(I2Cx, ENABLE);
I2C_NACKPositionConfig(I2Cx, I2C_NACKPosition_Current);
// Initiate Start Sequence (wait for EV5)
I2C_GenerateSTART(I2Cx, ENABLE);
// Timed(!I2C_GetFlagStatus(I2Cx, I2C_EVENT_MASTER_MODE_SELECT)); <- THIS LINE fails
// Send Address
I2C_Send7bitAddress(I2Cx, SlaveAddress, I2C_Direction_Receiver);
...

Enjoy your vacation,
Stephan

from stm32-template.

Related Issues (7)

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.