Help regarding with PSoc 6 with i2c temperature sensor with FreeRTOS.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
alishoaib1111
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Hi Community, 

Hope you are good. Did anyone has example of any temperature sensor with it's .c file written in freertos?

I am trying to write it but facing a problem. Can anyone help me on this ?

 

Regards, 

Ali Shoaib

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Hi @alishoaib1111 ,

I went through the data sheet of the as6221 and the temperature sensor seems pretty straight forward except for the use of the alert pin usage which will depend on your hardware configuration and the settings for the same can be set in the configuration register.

I have created a template firmware here which uses FreeRTOS with I2C and the same was developed for the CY8CPROTO-062-4343W kit.

You can do read and write to your i2c device using the cyhal_i2c_master_mem_read and write to the device using the cyhal_i2c_master_mem_write HAL API's.

Here I used an I2C slave like Infineon DPS310 pressure sensor which contains an inbuilt temperature sensor. I have just read the revision ID of the device in this template to demonstrate how to use the read API.

In your case , you may have to set the data in the configuration registers using the  cyhal_i2c_master_mem_write before you can start to read data from the temperature register using the cyhal_i2c_master_mem_read API.

This template will help you get started with Free RTOS.

You can also follow the steps in this link to setup Free RTOS in any of your projects in Modus Toolbox.

Regards
Alen

View solution in original post

0 Likes
12 Replies
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

Hi @alishoaib1111 ,

Can you please specify the error you are facing in more detail?

I do have a temperature sensor and a PSoC 6 BLE Pioneer Kit and can try out your implementation if you can provide more details on the same.

Can you also please let me know which PSoC 6 device you are using and the IDE for developmment?(Modus Toolbox or PSoC Creator)

Regards
Alen

0 Likes
alishoaib1111
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Hi @AlenAn14,

i am using modustoolbox and sensor name is as6221 and i am looking for its driver. Can you please share the things which you have.

 

Regards, 

Ali Shoaib 

0 Likes
lock attach
Attachments are accessible only for community members.

Hi @alishoaib1111 ,

I went through the data sheet of the as6221 and the temperature sensor seems pretty straight forward except for the use of the alert pin usage which will depend on your hardware configuration and the settings for the same can be set in the configuration register.

I have created a template firmware here which uses FreeRTOS with I2C and the same was developed for the CY8CPROTO-062-4343W kit.

You can do read and write to your i2c device using the cyhal_i2c_master_mem_read and write to the device using the cyhal_i2c_master_mem_write HAL API's.

Here I used an I2C slave like Infineon DPS310 pressure sensor which contains an inbuilt temperature sensor. I have just read the revision ID of the device in this template to demonstrate how to use the read API.

In your case , you may have to set the data in the configuration registers using the  cyhal_i2c_master_mem_write before you can start to read data from the temperature register using the cyhal_i2c_master_mem_read API.

This template will help you get started with Free RTOS.

You can also follow the steps in this link to setup Free RTOS in any of your projects in Modus Toolbox.

Regards
Alen

0 Likes

Hi Alen! 

Thank you for providing information. The thing which i figured out and may you can help me in this regard. Do  you have a driver for as6221?

The drivers which we used for modustoolbox.

 

Regards, 

Ali Shoaib

0 Likes

Hi @alishoaib1111 ,

No we do not have the driver for this sensor. It will be best if you check with the manufacturer of this temperature sensor for the same.

Regards
Alen

0 Likes
alishoaib1111
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Hi Alen, 

Sure i will check for that. The other thing is that there is only one driver of it available on website. That is linux. 

Regards, 

Ali Shoaib 

0 Likes
alishoaib1111
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Hi Alen, 

Can you provide me some example for communicating two psoc devices together like one is master and other is slave? 

I am very grateful if you can provide me a link of it. 

 

Regards, 

Ali Shoaib

0 Likes
AlenAn14
Moderator
Moderator
Moderator
500 replies posted 100 solutions authored 250 replies posted

Hi @alishoaib1111 ,

You can use the 2 code examples provided in modus toolbox (Shown in the below image).
You can load the mtb-example-psoc6-i2c-slave-callback example into one device and the mtb-example-psoc6-i2c-master example into the other and try to communicate between the 2.

 

AlenAn14_0-1642692028955.png

Hope this helps.

Regards
Alen

0 Likes
alishoaib1111
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Hi Alen, 

Thank you for your reply. Can you please tell do you know any course which is modustoolbox with free rtos?

If you know anyone then do let me know please. 

 

Regards, 

Ali Shoaib.

0 Likes

Hi @alishoaib1111 ,

You can refer to the video in this link to get an understanding of how to use FreeRTOS in PSoC 6 devices although the video is for PSoC Creator. You can also go through the whole playlist to understand how FreeRTOS API's are used as well which I highly recommend.

After referring to this you can look through the ReadMe provided on the Infineon Github page for understanding how to set up FreeRTOS in Modus Toolbox. You can then use the Free RTOS API's learned from the videos I mentioned above in Modus Toolbox as well (which will remain the same).

Hope this helps.

Regards
Alen

0 Likes
alishoaib1111
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Hi Alen! 

Do you have any example which show the connectivity of logic analzyer with psoc 6 mcu ?

If you have any can you please share it ?

 

Regards, 

Ali Shoaib

0 Likes

Hi @alishoaib1111 ,

We do not have any example projects that make use of logic analyzers. You will have to use the software that is provided by the manufacturers of the logic analyzer to analyze the signal on the lines you want to observe data on.

Regards
Alen

0 Likes