ST意法半导体
直播中

陈玉英

7年用户 135经验值
私信 关注
[问答]

示例代码TSL V.2.4.0可以在STM8S105C6和STM8S103K3上运行吗?

我尝试在''Example01_STM8S207_RC_5k'中修改TSL V.2.4.0中的代码,以便在STM8S103K3和STM8S105C6上运行。

测试STM8S发现(对于STM8S105C6)。
按照TSL文档修改代码但不起作用。

LED闪烁(项目基本代码可调节LED闪烁速度),
但触摸感觉发生了。
LED闪烁速度不变。
STM8S105C6T6和STM8S103K3

我想,我试着在文件中说出来。
有人可以向我展示示例代码(对于Cosmic编译器很棒)。

谢谢提前。

以上来自于谷歌翻译


以下为原文




I try to modify code from TSL V.2.4.0 in ''Example01_STM8S207_RC_5k'' for run on STM8S103K3 and STM8S105C6.

Test on board STM8S discovery (for STM8S105C6).
Follow TSL document to modify code but it not work.

LED is blink (base code on project Adjustable LED blinking speed),
but on touch sense notting happen.  
LED blink speed not change.
Both STM8S105C6T6 and STM8S103K3

I think, I try every thing in document say.
Can some one show me for the example code (for Cosmic compiler is great).

Thank for advance.

回帖(5)

冯超

2019-4-4 08:38:42
你能否更好地描述正在发生/未发生的事情?你做了什么来配置TSL?
 
如果你的程序正在运行,请观察变量sSCKeyInfo [key_number] .state,sSCKeyInfo [key_number] .Channel.LastMeasure和sSCKeyInfo [key_number]。使用STVD调试器的参考(http://www.st.com/internet/evalboard/产品/ 210567.jsp
)或STMStudio(http://www.st.com/internet/evalboard/product/251373.jsp
并描述正在发生的事情。
关键在哪个状态?
sSCKeyInfo [key_number] .LastMeasure在您触摸按键时会改变吗?

以上来自于谷歌翻译


以下为原文





Could you please describe better what is happening/not happening? what have you done to configure the TSL?

If your program is running, watch the variables sSCKeyInfo[key_number].state, sSCKeyInfo[key_number].Channel.LastMeasure and sSCKeyInfo[key_number].Reference using the STVD debugger (http://www.st.com/internet/evalboard/product/210567.jsp
) or the STMStudio (http://www.st.com/internet/evalboard/product/251373.jsp
) and describe what is happening.
In which state are the keys?
Is sSCKeyInfo[key_number].LastMeasure changing when you touch the keys?
举报

陈玉英

2019-4-4 08:57:27
我在STM8S105C6上重新检查配置。
 
 我的配置有些错误。
 现在它完成了工作。
 
 但是在STM8S103K3上无法正常工作。
 
 在调试中
 sSCKeyInfo [KEY_NUMBER] .STATE
 .whole = 8' b'
 .b所有值均为0,ERROR为1。
 
 sSCKeyInfo [KEY_NUMBER] .Channel
 .LastMeasure = 0
 .Reference = 0
 
 然后我尝试一步。
 在TSL_Action()设置断点;
 当调用TSL_Action();大概3-4次。
 sSCKeyInfo [key_number] .state.b.CALIBRATION设置为1。
 之后,ERROR设置为1。
 ERROR设置为1后,值永远不会改变。(触摸或不触摸)
 
 对于STM8S103K3,我使用STM8S发现板
 移除STM8S105C6并从STM8S103的引脚重新接线到CN1,CN2,CN3和CN4。
 并像这样连接引脚
 TL_Load是PE5
 点触发是PB0
 LED是PC1
 与STM8S105C6不同,因为它易于接线。
 
 我想这些信息可能很有用。
 我没有示波器但是,我在TS_Load尝试电压表。
 在STM8S105C6上的值约为2 V.
 但STM8S103K3为0 V.
 
 
 现在,接下来我该怎么办?
 
 
 
 一些配置
 
 
 / *根据您使用的目标STM8S或STM8A设备取消注释以下行
 应用。 * /
 
 / * #define STM8S208 * / / *!< STM8S带CAN * /的高密度设备
 / * #define STM8S207 * / / *!< STM8S不带CAN * /的高密度设备
 / * #define STM8AF52Ax * / / *!< STM8A带CAN * /的高密度设备
 / * #define STM8AF62Ax * / / *!< STM8A不带CAN * /的高密度设备
 / * #define STM8S105 * / / *!< STM8S中密度设备* /
 / * #define STM8AF626x * / / *!< STM8A中密度设备* /
 #define STM8S103 / *!< STM8S低密度设备* /
 / * #define STM8S903 * / / *!< STM8S低密度设备* /

以上来自于谷歌翻译


以下为原文





I recheck config on STM8S105C6.

My configuration some value wrong.
Now it's work done.

But on STM8S103K3 not work.

in debugging
sSCKeyInfo[key_number].state
   .whole = 8 'b'
   .b all value is 0 only ERROR is 1.

sSCKeyInfo[key_number].Channel
   .LastMeasure = 0
   .Reference = 0

Then I try step run.
Set break point at TSL_Action();
When call TSL_Action(); about 3-4 time.
sSCKeyInfo[key_number].state.b.CALIBRATION set to 1.
After that ERROR is set to 1.
Value never change after ERROR set to 1. (with touch or not touch)

For STM8S103K3, I use STM8S discovery board by  
remove STM8S105C6 and re wiring from STM8S103's pin to CN1, CN2, CN3 and CN4.
And connect pin like this
TL_Load is PE5
Point touch sence is PB0
LED is PC1
Not same as STM8S105C6 because it's easy to wire.

I guess this information may be usefull.
I not have oscilloscope but, I try volt meter at TS_Load.
On STM8S105C6 value is about 2 V.
but STM8S103K3 is 0 V.


Now, what can I do next ?



Some configuration


/* Uncomment the line below according to the target STM8S or STM8A device used in your
    application. */

  /* #define STM8S208 */      /*!< STM8S High density devices with CAN */
  /* #define STM8S207 */      /*!< STM8S High density devices without CAN */
  /* #define STM8AF52Ax */    /*!< STM8A High density devices with CAN */
  /* #define STM8AF62Ax */    /*!< STM8A High density devices without CAN */
  /* #define STM8S105 */      /*!< STM8S Medium density devices */
  /* #define STM8AF626x */    /*!< STM8A Medium density devices */
#define STM8S103       /*!< STM8S Low density devices */
  /* #define STM8S903 */      /*!< STM8S Low density devices */
举报

陈玉英

2019-4-4 09:09:28
#define MCU_SELECTION(4)
 
 #define TIMACQ(TIM2)
 #define TIMACQ_CNTR_ADD(0x530C)
 
 #define TIMTICK(TIM4)
 
 #define LOADREF_PORT_ADDR(GPIOE_BaseAddress)/ **&lt; LOADREF引脚GPIO基地址* /
 #define LOADREF_BIT(0x20)/ **&lt; LOADREF引脚掩码* /
 
 #define SCKEY_P1_KEY_COUNT(1)
 
 #define SCKEY_P1_PORT_ADDR(GPIOB_BaseAddress)/ **&lt;单通道密钥端口1:GPIO基地址* /
 #define SCKEY_P1_A(0x01)/ **&lt;单通道键端口1:第一键掩码* /
 #define SCKEY_P1_B(0)/ **&lt;单通道键端口1:第二键掩码* /
 #define SCKEY_P1_C(0)/ **&lt;单通道键端口1:第三键掩码* /
 #define SCKEY_P1_D(0)/ **&lt;单通道键端口1:第四键掩码* /
 #define SCKEY_P1_E(0)/ **&lt;单通道键端口1:第五键掩码* /
 #define SCKEY_P1_F(0)/ **&lt;单通道键端口1:第六键掩码* /
 #define SCKEY_P1_G(0)/ **&lt;单通道键端口1:第7键掩码* /
 #define SCKEY_P1_H(0)/ **&lt;单通道键端口1:第8键掩码* /
 #define SCKEY_P1_DRIVEN_SHIELD_MASK(0x00)
 
 #define GPIOA_ELECTRODES_MASK(0x00)/ **&lt; GPIOA的电极掩膜* /
 #define GPIOB_ELECTRODES_MASK(0x01)/ **&lt; GPIOB的电极掩膜* /
 #define GPIOC_ELECTRODES_MASK(0x00)/ **&lt; GPIOC的电极掩模* /
 #define GPIOD_ELECTRODES_MASK(0x00)/ **&lt; GPIOD的电极掩膜* /
 #define GPIOE_ELECTRODES_MASK(0x00)/ **&lt; GPIOE的电极掩膜* /
 #define GPIOF_ELECTRODES_MASK(0x00)/ **&lt; GPIOF的电极掩模* /
 #define GPIOG_ELECTRODES_MASK(0x00)/ **&lt; GPIOG的电极掩膜* /
 #define GPIOH_ELECTRODES_MASK(0x00)/ **&lt; GPIOH的电极掩膜* /
 #define GPIOI_ELECTRODES_MASK(0x00)/ **&lt; GPIOI的电极掩膜* /

以上来自于谷歌翻译


以下为原文








#define MCU_SELECTION  (4)

#define TIMACQ           (TIM2)
#define TIMACQ_CNTR_ADD  (0x530C)

#define TIMTICK         (TIM4)

#define LOADREF_PORT_ADDR  (GPIOE_BaseAddress)  /**< LOADREF pin GPIO base address */
#define LOADREF_BIT        (0x20)               /**< LOADREF pin mask */

#define SCKEY_P1_KEY_COUNT  (1)

#define SCKEY_P1_PORT_ADDR  (GPIOB_BaseAddress)  /**< Single channel key Port 1: GPIO base address */
#define SCKEY_P1_A  (0x01)  /**< Single channel key Port 1: 1st key mask */
#define SCKEY_P1_B  (0)  /**< Single channel key Port 1: 2nd key mask */
#define SCKEY_P1_C  (0)  /**< Single channel key Port 1: 3rd key mask */
#define SCKEY_P1_D  (0)  /**< Single channel key Port 1: 4th key mask */
#define SCKEY_P1_E  (0)     /**< Single channel key Port 1: 5th key mask */
#define SCKEY_P1_F  (0)     /**< Single channel key Port 1: 6th key mask */
#define SCKEY_P1_G  (0)     /**< Single channel key Port 1: 7th key mask */
#define SCKEY_P1_H  (0)     /**< Single channel key Port 1: 8th key mask */
#define SCKEY_P1_DRIVEN_SHIELD_MASK (0x00)

#define GPIOA_ELECTRODES_MASK  (0x00)  /**< Electrodes mask for GPIOA */
#define GPIOB_ELECTRODES_MASK  (0x01)  /**< Electrodes mask for GPIOB */
#define GPIOC_ELECTRODES_MASK  (0x00)  /**< Electrodes mask for GPIOC */
#define GPIOD_ELECTRODES_MASK  (0x00)  /**< Electrodes mask for GPIOD */
#define GPIOE_ELECTRODES_MASK  (0x00)  /**< Electrodes mask for GPIOE */
#define GPIOF_ELECTRODES_MASK  (0x00)  /**< Electrodes mask for GPIOF */
#define GPIOG_ELECTRODES_MASK  (0x00)  /**< Electrodes mask for GPIOG */
#define GPIOH_ELECTRODES_MASK  (0x00)  /**< Electrodes mask for GPIOH */
#define GPIOI_ELECTRODES_MASK  (0x00)  /**< Electrodes mask for GPIOI */
举报

冯超

2019-4-4 09:21:13
密钥进入错误状态的最常见原因是当实际度量超出允许范围时。
 
尝试更改配置文件中的SCKEY_MIN_ACQUISITION和SCKEY_MAX_ACQUISITIONdefinition

以上来自于谷歌翻译


以下为原文





The most common cause of the keys going in error state is when the actual measure is out of the allowed range.

try changing the SCKEY_MIN_ACQUISITION  and SCKEY_MAX_ACQUISITIONdefinition in the configuration file
举报

更多回帖

发帖
×
20
完善资料,
赚取积分