cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

Contributor

I have been trying to use the Thermistor Calculator Component on a 4000S Device.  In Creator for this 4000S device(CY8C4025LQI-S412) i am using, this thermistor component is not available.  So I complied and tested this component (in LUT mode) on my CY8KIT-043 which has a 4000M device, and it works great.  For the Calculator the datasheet says generates the temperature based on feeding it the thermistor resistance which needs to be calculated prior to calling the function.  I believe I have a handle on getting the resistance calculated properly using the ADC_CSD in the 4000S device.  Using the code from the CY8Kit-043 I copied the component thermistor code to my 4000S project, but my issue is i can not get it to compile properly.  I keep getting compiler errors that are related to the component  functions calls.  I am not real familiar with the proper application of copying the .h and .c files to make this work properly.  Could i get some help in looking over my code to see why i keep getting build errors related to undefined reference for the functions of this component so it can be used properly.

FYI: Note i was able to get the thermistor reading using straight math functions but it takes up way to much memory for my small device.   I need to use the lower memory approach of a look up table (LUT) used in the Thermistor Calculator Component.

Thanks

Scott

0 Likes
Reply
1 Solution
Esteemed Contributor

Dear ScCl-san,

I downloaded and tried to compile the program

and I received errors saying that no reference to

Thermistor_GetResistance

Thermistor_GetTemperature

But surely they were in Thermistor.c

Then I took a look at the last line of output

and found that there was no Thrmistor.o after main.o

==================

arm-none-eabi-gcc.exe

-Wl,--start-group

-o "C:\Users\Rhyme\Desktop\PSoC400S_Thermistor\Thermistor Test PSoC 4000S ADC_CSD_LUT.cydsn\CortexM0p\ARM_GCC_541\Debug\Thermistor Test PSoC 4000S ADC_CSD_LUT.elf"

.\CortexM0p\ARM_GCC_541\Debug\main.o

.\CortexM0p\ARM_GCC_541\Debug\cyfitter_cfg.o

.\CortexM0p\ARM_GCC_541\Debug\cymetadata.o

.\CortexM0p\ARM_GCC_541\Debug\Cm0plusStart.o

".\CortexM0p\ARM_GCC_541\Debug\Thermistor Test PSoC 4000S ADC_CSD_LUT.a"

"..\..\..\Documents\PSoC Creator\4.2\Downloads ( 4.2).cylib\CapSense_P4_v6_0\PSoC4\Library\Capsense_P4Library_GCCp.a"

-mcpu=cortex-m0plus -mthumb -L Generated_Source\PSoC4 "-Wl,-Map,.\CortexM0p\ARM_GCC_541\Debug/Thermistor Test PSoC 4000S ADC_CSD_LUT.map"

-T Generated_Source\PSoC4\cm0plusgcc.ld

-specs=nano.specs

-Wl,--gc-sections

-g

-ffunction-sections

-Og

-ffat-lto-objects

-Wl,--end-group

.\CortexM0p\ARM_GCC_541\Debug\main.o: In function `main':

==================

So what I tried were

(1) remove both Thermistor.h and Thermistor.c from the project

(2) using add existing files, I added both Thermistor.h and Thermistor.c

(3) Clean and Build

Then the project could be built

Project-Built.JPG

And the last line of the output was below.

Now we have "Thermistor.o" after "main.o"

==================

arm-none-eabi-gcc.exe

-Wl,--start-group

-o "C:\Users\Rhyme\Desktop\PSoC400S_Thermistor\Thermistor Test PSoC 4000S ADC_CSD_LUT.cydsn\CortexM0p\ARM_GCC_541\Debug\Thermistor Test PSoC 4000S ADC_CSD_LUT.elf"

.\CortexM0p\ARM_GCC_541\Debug\main.o

.\CortexM0p\ARM_GCC_541\Debug\Thermistor.o

.\CortexM0p\ARM_GCC_541\Debug\cyfitter_cfg.o

.\CortexM0p\ARM_GCC_541\Debug\cymetadata.o

.\CortexM0p\ARM_GCC_541\Debug\Cm0plusStart.o

".\CortexM0p\ARM_GCC_541\Debug\Thermistor Test PSoC 4000S ADC_CSD_LUT.a"

"..\..\..\Documents\PSoC Creator\4.2\Downloads ( 4.2).cylib\CapSense_P4_v6_0\PSoC4\Library\Capsense_P4Library_GCCp.a"

-mcpu=cortex-m0plus

-mthumb

-L Generated_Source\PSoC4

"-Wl,-Map,.\CortexM0p\ARM_GCC_541\Debug/Thermistor Test PSoC 4000S ADC_CSD_LUT.map"

-T Generated_Source\PSoC4\cm0plusgcc.ld

-specs=nano.specs

-Wl,--gc-sections

-g -ffunction-sections

-Og

-ffat-lto-objects

-Wl,--end-group

cyelftool.exe -C "C:\Users\Rhyme\Desktop\PSoC400S_Thermistor\Thermistor Test PSoC 4000S ADC_CSD_LUT.cydsn\CortexM0p\ARM_GCC_541\Debug\Thermistor Test PSoC 4000S ADC_CSD_LUT.elf"

--flash_row_size 128 --flash_size 32768 --flash_offset 0x00000000

No ELF section .cychecksum found, creating one

==================

moto

View solution in original post

0 Likes
Reply
5 Replies
Contributor

I updated my code that I hope will work if i can get the Thermistor functions to work.  I still am getting errors and at my current understanding i don't know why.

Thanks

Scott

0 Likes
Reply
Esteemed Contributor

Dear Scott-san,

I think that to use LUT, you need UDB module in the device.

I'm afraid that 4000S does not have UDB, although 4000M has.

May be tweaking SmartIO can provide some LUT functionalities,

but considering the size of the device,

I'm not sure if you can replace the component

within the capability of available SmartIOs.

BTW, In your attached project,

"Test PSoC  4000S ADC_CSD_LUT"

does not seem to be included.

Best Regards,

7-Aug-2018

Motoo Tanaka

0 Likes
Reply
Contributor

Dear Motoo,

Thank you for your attention to trying to help me.  I have attached my project again and loaded it to make sure it has no errors this time.  You mentioned the need for a UDB, but i don't believe this Cypress component requires one.  To check this I loaded just the component only into a project with a 4000M (CY8KIT-043) part and and checked the resources and it does not use any UDB's in its operation.

If you compile my project you will see i get errors reading the function calls of the component and i just don't understand why!

0 Likes
Reply
Esteemed Contributor

Dear ScCl-san,

I downloaded and tried to compile the program

and I received errors saying that no reference to

Thermistor_GetResistance

Thermistor_GetTemperature

But surely they were in Thermistor.c

Then I took a look at the last line of output

and found that there was no Thrmistor.o after main.o

==================

arm-none-eabi-gcc.exe

-Wl,--start-group

-o "C:\Users\Rhyme\Desktop\PSoC400S_Thermistor\Thermistor Test PSoC 4000S ADC_CSD_LUT.cydsn\CortexM0p\ARM_GCC_541\Debug\Thermistor Test PSoC 4000S ADC_CSD_LUT.elf"

.\CortexM0p\ARM_GCC_541\Debug\main.o

.\CortexM0p\ARM_GCC_541\Debug\cyfitter_cfg.o

.\CortexM0p\ARM_GCC_541\Debug\cymetadata.o

.\CortexM0p\ARM_GCC_541\Debug\Cm0plusStart.o

".\CortexM0p\ARM_GCC_541\Debug\Thermistor Test PSoC 4000S ADC_CSD_LUT.a"

"..\..\..\Documents\PSoC Creator\4.2\Downloads ( 4.2).cylib\CapSense_P4_v6_0\PSoC4\Library\Capsense_P4Library_GCCp.a"

-mcpu=cortex-m0plus -mthumb -L Generated_Source\PSoC4 "-Wl,-Map,.\CortexM0p\ARM_GCC_541\Debug/Thermistor Test PSoC 4000S ADC_CSD_LUT.map"

-T Generated_Source\PSoC4\cm0plusgcc.ld

-specs=nano.specs

-Wl,--gc-sections

-g

-ffunction-sections

-Og

-ffat-lto-objects

-Wl,--end-group

.\CortexM0p\ARM_GCC_541\Debug\main.o: In function `main':

==================

So what I tried were

(1) remove both Thermistor.h and Thermistor.c from the project

(2) using add existing files, I added both Thermistor.h and Thermistor.c

(3) Clean and Build

Then the project could be built

Project-Built.JPG

And the last line of the output was below.

Now we have "Thermistor.o" after "main.o"

==================

arm-none-eabi-gcc.exe

-Wl,--start-group

-o "C:\Users\Rhyme\Desktop\PSoC400S_Thermistor\Thermistor Test PSoC 4000S ADC_CSD_LUT.cydsn\CortexM0p\ARM_GCC_541\Debug\Thermistor Test PSoC 4000S ADC_CSD_LUT.elf"

.\CortexM0p\ARM_GCC_541\Debug\main.o

.\CortexM0p\ARM_GCC_541\Debug\Thermistor.o

.\CortexM0p\ARM_GCC_541\Debug\cyfitter_cfg.o

.\CortexM0p\ARM_GCC_541\Debug\cymetadata.o

.\CortexM0p\ARM_GCC_541\Debug\Cm0plusStart.o

".\CortexM0p\ARM_GCC_541\Debug\Thermistor Test PSoC 4000S ADC_CSD_LUT.a"

"..\..\..\Documents\PSoC Creator\4.2\Downloads ( 4.2).cylib\CapSense_P4_v6_0\PSoC4\Library\Capsense_P4Library_GCCp.a"

-mcpu=cortex-m0plus

-mthumb

-L Generated_Source\PSoC4

"-Wl,-Map,.\CortexM0p\ARM_GCC_541\Debug/Thermistor Test PSoC 4000S ADC_CSD_LUT.map"

-T Generated_Source\PSoC4\cm0plusgcc.ld

-specs=nano.specs

-Wl,--gc-sections

-g -ffunction-sections

-Og

-ffat-lto-objects

-Wl,--end-group

cyelftool.exe -C "C:\Users\Rhyme\Desktop\PSoC400S_Thermistor\Thermistor Test PSoC 4000S ADC_CSD_LUT.cydsn\CortexM0p\ARM_GCC_541\Debug\Thermistor Test PSoC 4000S ADC_CSD_LUT.elf"

--flash_row_size 128 --flash_size 32768 --flash_offset 0x00000000

No ELF section .cychecksum found, creating one

==================

moto

View solution in original post

0 Likes
Reply
Contributor

Motoo,

Thank you! ..... I deleted them as you directed, then copied them into project the using the "Existing Item..." from the 4000M project and it did compile as you showed.  I just used a typical a right click copy command when I move them into my project.  I don't understand why my copy method did not work but its nice to get my project running!

Thanks again