cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 4

PaHe_1325231
New Contributor

Hi

   

 

   

Could someone glance over my attached project. It is of I2C master taking data from BME280 environmental sensor and then transmitting the data out over BLE. I would like to view this data in Cysmart but I am unable to do so. Could someone have a look over my project please.

   

 

   

Regards

0 Likes
1 Solution
Bob_Marlowe
Expert II

In your i2c.h are two warnings which show up errors.

   

In BME_WriteReg() you have the line

   

    I2C_1_I2CMasterWriteBuf(BME_ADDR,(uint8 *)Write_Buf,2,I2C_1_I2C_MODE_COMPLETE_XFER);

   

Take the term (uint8 *)Write_Buf

   

Write_Buf is an array of 32bit integers and your statement will transfer the first two bytes of the array. That does not match at all.

   

Same applies for the warning-flagged lines.

   

 

   

Bob

View solution in original post

0 Likes
7 Replies
Bob_Marlowe
Expert II

In your i2c.h are two warnings which show up errors.

   

In BME_WriteReg() you have the line

   

    I2C_1_I2CMasterWriteBuf(BME_ADDR,(uint8 *)Write_Buf,2,I2C_1_I2C_MODE_COMPLETE_XFER);

   

Take the term (uint8 *)Write_Buf

   

Write_Buf is an array of 32bit integers and your statement will transfer the first two bytes of the array. That does not match at all.

   

Same applies for the warning-flagged lines.

   

 

   

Bob

View solution in original post

0 Likes
PaHe_1325231
New Contributor

Hi Bob

   

 

   

Thanks for coming back to me, I think i know what you are getting at, basically I am mixing my data types? going from 32 bit unsigned to 8 bit? Unfortunately programming is not my strongest asset but i am learning

   

 

   

Regards

0 Likes
Bob_Marlowe
Expert II

Yes, uint8 would be better.

   

 

   

Bob

PaHe_1325231
New Contributor

Cheers Bob

   

 

   

much appreciated. 

   

 

   

Regards

   

 

   

paddy

0 Likes
PaHe_1325231
New Contributor

Hi again Bob,if you wouldn't mind, i think this is sorted?

   

Regards

0 Likes
Anonymous
Not applicable

Hey buddy

Is it working now? I just want to look out this project.

If it is done, please share the same at suranibharat4@gmail.com, it would be such a kind of you for me.

Regards,

BS

0 Likes
Bob_Marlowe
Expert II

Go through the rest of your program, the returned value must not be a uint32 but an uint8. Same for main(). You ought to transmit the combined high and low pressure value as

   

uint16 Value;

   

Value = ((uint16)HighByte << 😎 | LowByte;

   

I miss a BLE_Start() API

   

 

   

Bob