MCP356x1 Init problem

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
stefan.erni
Valued Contributor
Posts: 1065
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 201 times
Been thanked: 224 times

MCP356x1 Init problem

Post by stefan.erni »

Hi to All

If I use the MCP356x1 init macro I get an error.
C:/Users/Desktop/esp-idf-2/mtxesp32s_sdkconfig/main/esp-project.c: In function 'FCD_07892_ADC_MCP356X1__Initialise':
C:/Users/Desktop/esp-idf-2/mtxesp32s_sdkconfig/main/esp-project.c:533:10: error: 'FCR_RETVAL' is used uninitialized [-Werror=uninitialized]
Attachments
Post_MCP1.fcfx
(9.52 KiB) Downloaded 45 times

BenR
Matrix Staff
Posts: 1951
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 510 times
Been thanked: 696 times

Re: MCP356x1 Init problem

Post by BenR »

Hi Stefan,

Thanks for letting us know, hopefully resolved for you now via library updates.

stefan.erni
Valued Contributor
Posts: 1065
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 201 times
Been thanked: 224 times

Re: MCP356x1 Init problem

Post by stefan.erni »

Hi Ben

Yes. Perfect! It's working.
Thank you very much.

Stefan

stefan.erni
Valued Contributor
Posts: 1065
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 201 times
Been thanked: 224 times

Re: MCP356x1 Init problem

Post by stefan.erni »

Hi Ben

I can compile, but when I send measured values to uart, I get an invalid device handle from SPI instead of measured values.

from my terminal program:
2025-08-04_12-09-27.PNG
2025-08-04_12-09-27.PNG (32.5 KiB) Viewed 581 times
Attachments
Post_MCP2.fcfx
(12.54 KiB) Downloaded 32 times

stefan.erni
Valued Contributor
Posts: 1065
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 201 times
Been thanked: 224 times

Re: MCP356x1 Init problem

Post by stefan.erni »

Hi Ben

It's working now.
First I tested in software mode SPI and it was ok.

Then I reduced the prescale from 40Mhz to 20Mhz like in the pdf from the MCP35x1 and now the value are ok and no messages

reduced:
SNAG-0020.PNG
SNAG-0020.PNG (63.01 KiB) Viewed 561 times
result:
2025-08-05_09-58-09.PNG
2025-08-05_09-58-09.PNG (89.09 KiB) Viewed 561 times

Post Reply