cancel
Showing results for 
Search instead for 
Did you mean: 

Touch Sensing with CubeMX and stm32l152-discovery

gates.nathan
Associate III
Posted on September 16, 2016 at 22:59

I'm really struggling to get Touch Sensing working on the stm32L152 RCT6 discovery board. I'm trying to use it with CubeMX and understand that there is a particular procedure to use the Touch lib with CubeMX. Could anyone please explain the process, and have an example project to get up  and running with?

I have looked at the example included in the firmware package for cubemx, but it is for the stm32l152D_EVAL board and I'm even having trouble getting that to compile.

Thanks

#cubemx #stm32l152 #touch-sensing
5 REPLIES 5
slimen
Senior
Posted on September 17, 2016 at 23:44

Hi,

The Touch Sensing library is not supported by CubeMx in the code generation, only the pinout is configured for Touch Sensing peripheral. So, you have to add TSL library manually (STM32Cube_FW_L1_V1.6.0\Middlewares\ST\STM32_TouchSensing_Library from

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubel1.html

) and configure properly all paths for required files.

You can start from the TouchSensing example for stm32l152D_EVAL board and get inspiration from this example to develop your project.

You may find more details on how to use the TSL with the

http://www.st.com/content/ccc/resource/technical/document/user_manual/group0/d6/4c/20/0d/a1/c1/4c/99/DM00210526/files/DM00210526.pdf/jcr:content/translations/en.DM00210526.pdf

: ''Developing applications on STM32Cube with touch sensing''.

Regards

gates.nathan
Associate III
Posted on September 20, 2016 at 06:54

Thanks for the response. I've tried creating a new project for the stm32L152-disco based off of the stm32L152D_EVAL project on the firmware package, but im running into some issues. Ive linked all the library files as it is done in this project and im getting these errors:

Description Resource Path Location Type
'RI_TypeDef {aka struct <
anonymous
>}' has no member named 'CMR5' tsl_acq_stm32l1xx_hw.c /TouchSensor_manualInclude/Middlewares/STM32_TouchSensing_Library line 162 C/C++ Problem
'RI_TypeDef {aka struct <
anonymous
>}' has no member named 'CICR4' tsl_acq_stm32l1xx_hw.c /TouchSensor_manualInclude/Middlewares/STM32_TouchSensing_Library line 163 C/C++ Problem
'RI_TypeDef {aka struct <
anonymous
>}' has no member named 'ASMR4' tsl_acq_stm32l1xx_hw.c /TouchSensor_manualInclude/Middlewares/STM32_TouchSensing_Library line 161 C/C++ Problem
'RI_TypeDef {aka struct <
anonymous
>}' has no member named 'ASMR5' tsl_acq_stm32l1xx_hw.c /TouchSensor_manualInclude/Middlewares/STM32_TouchSensing_Library line 161 C/C++ Problem
'RI_TypeDef {aka struct <
anonymous
>}' has no member named 'CMR4' tsl_acq_stm32l1xx_hw.c /TouchSensor_manualInclude/Middlewares/STM32_TouchSensing_Library line 162 C/C++ Problem
initializer element is not constant tsl_acq_stm32l1xx_hw.c /TouchSensor_manualInclude/Middlewares/STM32_TouchSensing_Library line 162 C/C++ Problem
'RI_TypeDef {aka struct <
anonymous
>}' has no member named 'ASMR4' tsl_acq_stm32l1xx_hw.c /TouchSensor_manualInclude/Middlewares/STM32_TouchSensing_Library line 522 C/C++ Problem
'RI_TypeDef {aka struct <
anonymous
>}' has no member named 'ASMR5' tsl_acq_stm32l1xx_hw.c /TouchSensor_manualInclude/Middlewares/STM32_TouchSensing_Library line 523 C/C++ Problem
initializer element is not constant tsl_acq_stm32l1xx_hw.c /TouchSensor_manualInclude/Middlewares/STM32_TouchSensing_Library line 163 C/C++ Problem
'RI_TypeDef {aka struct <
anonymous
>}' has no member named 'CICR5' tsl_acq_stm32l1xx_hw.c /TouchSensor_manualInclude/Middlewares/STM32_TouchSensing_Library line 163 C/C++ Problem

Can you please assist me, Thanks
slimen
Senior
Posted on September 20, 2016 at 11:33

Hi,

I think this is due to use incompatible library versions and include files.

So, make sure that the include libraries paths are configured correctly into the project from the correct directories.

Regards

gates.nathan
Associate III
Posted on September 20, 2016 at 15:33

Hi 

I'm still struggling with this. Could you walk me through what I need to include, and where I need to include it? My understanding is that I need to include (STM32Cube_FW_L1_V1.6.0\Middlewares\ST\STM32_TouchSensing_Library) can you tell me where and how.

I really need to get this working.

thanks

John Davis_2
Associate II
Posted on April 05, 2017 at 22:33

Nate,

Here is how I got started.

1.  Using a discovery board, I located the complete example in my copy of the firmware installed by the cube for my board.

C:\Users\John.Davis\Documents\john-f-davis\discovery-meta\Projects\STM32F072B-Discovery\Applications\TouchSensing\TouchSensing_Linear

2.  I ran this code as is from this location.  The source is scattered about the directory.  For instance, the source for the touch library is up further in the directory tree.  ie. C:\Users\John.Davis\Documents\john-f-davis\discovery-meta\Middlewares\ST\STM32_TouchSensing_Library

3.  I pretty much just ran the sample out of the box to see it was working.

4.  Then I created a sample project using the cube for a discovery board.  I made sure the pins for the touch sensors were named to match the original project.  I had to look at the schematics for the discovery board to make sure I was doing it right.

5.  Then I copied over the touch library into my project.  I could not match the same pattern as the example code in terms of source files and header files where headers are included.  ie. the sample code has the tsl_user.h included in main.h.  If I do that it generates a ton of errors.  I have to put the include tsl_user.h line in my main.c file.  Once I can get this working I have a little more understanding of how its put together.

6.  Do the same thing for our custom board setup with an ioc cube project.