cancel
Showing results for 
Search instead for 
Did you mean: 

Could not make eMIOS1 working on SPC564B74

aurelien23
Senior
Posted on January 19, 2016 at 11:03

Hello,

I’m trying since more than a week to determine why is eMIOS1 not working on my SPC564B74L7. I’m now really out of idea and I need your support!

First I would like to submit you what I think is a bug. See icu_bug1.png: I had to add the highlighted code because when activating eMIOS1 alone, it was causing an unhandled exception. It is located around line 600.

In the attached project (SPC5Studio v3.7) when the code shown in icu_bug2.png is commented out (icu_start and icu_enable), my eMIOS0 ch.1 is working properly (I’m sending a message on the uart telling “ICUD2 is more (or less) than 1kHz�?)

But when not commented out, both eMIOS0 ch.1 and eMIOS1 ch.9 are working anymore… eMIOS1 ch.9 alone is also not working.

I added manually the declarations related to eMIOS1 ch.9 / ICUD16 in icu_lld.c and icu_lld.h. I checked them many times, doing some debug but I can’t find why it not working. Pins config are ok (eMIOS1 ch.9 is only mapped on PH[7] and is configured in Advanced mode to alternate 1 with IBE).

Can you please review the basic project attached and tell me what is wrong here??

Thank your for your support
This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
3 REPLIES 3
aurelien23
Senior
Posted on January 21, 2016 at 11:23

I finally found that icu_lld is NOT made to work with more than one channel activated because A2 temp registers are shared with all channels... I made them arrays to handle all channels and activating eMIOS0_ch0 and eMIOS1_ch24 is now working.

Please consider updating icu_lld with my changes attached.

I worked on the ICU-PWM wizard project and I will now apply this to my personnal project because I still don't know why eMIOS1_ch9 alone was not working.

Best Regards,

Aurélien

________________

Attachments :

icu_lld.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0YF&d=%2Fa%2F0X0000000baH%2FD.ShibecmLmaJC0K8Vef9i55rXf8ncimo760LlkNmzI&asPdf=false
Erwan YVIN
ST Employee
Posted on January 21, 2016 at 17:47 Hello Aurelien , good job and thanks for your sharing ;) i am submitting an ER on HAL and RLA too. 1) i have found an other issue in trying to enable IPWM(For Ultrasonic sensor) (with ICU) (Warning this patch is for RLA)

<?

xml
version

=

''1.0''
encoding

=

''UTF-8''

?>
<

SPC5-Patch
version

=

''1.0.0''

>
<!--It is your patch repository, do not break your XML File.-->
<

files

>
<

file
componentId

=

''com.st.spc5.components.lld.spc560dxx_rla''
version

=

''1.0.0.201601051715''
path

=

''component/lib/include/spc5_lld.h''
user

=

''false''

>
<

diff

/>
</

file

>
<

file
componentId

=

''com.st.spc5.components.lld.spc560dxx_rla''
version

=

''1.0.0.201601051715''
path

=

''component/lib/include/icu_lld.h''
user

=

''false''

>
<

diff

/>
</

file

>
<

file
componentId

=

''com.st.spc5.components.lld.spc560dxx_rla''
version

=

''1.0.0.201601051715''
path

=

''component/lib/src/icu_lld.c''
user

=

''false''

>
<

diff

>

<![CDATA[--- components/spc560dxx_low_level_drivers_component_rla/lib/src/icu_lld.c

+++ components/spc560dxx_low_level_drivers_component_rla/lib/src/icu_lld.c
@@ -172,6 +172,7 @@
} else if (icup->emiosp->CH[icup->ch_number].CSR.B.UCIN == 0 && \
icup->config->width_cb != NULL) {
A2_2 = icup->emiosp->CH[icup->ch_number].CADR.R;
+ A2_1 = icup->emiosp->CH[icup->ch_number].CBDR.R;
width = A2_2 - A2_1;
_icu_isr_invoke_width_cb(icup);
}
@@ -566,7 +567,7 @@
icup->emiosp->CH[icup->ch_number].CCR.B.UCPEN = 0;
icup->emiosp->CH[icup->ch_number].CCR.R |=
EMIOSC_BSL(EMIOS_BSL_INTERNAL_COUNTER) |
- EMIOSC_EDSEL | EMIOS_CCR_MODE_SAIC;
+ EMIOSC_EDSEL | EMIOS_CCR_MODE_IPWM;
icup->emiosp->CH[icup->ch_number].CCR.B.UCPRE = psc - 1;
icup->emiosp->CH[icup->ch_number].CCR.R |= EMIOSC_UCPREN;]]>

</

diff

>
</

file

>
<

file
componentId

=

''com.st.spc5.components.lld.spc560dxx_rla''
version

=

''1.0.0.201601200924''
path

=

''component/lib/src/icu_lld.c''
user

=

''false''

>
<

diff

>

<![CDATA[--- components/spc560dxx_low_level_drivers_component_rla/lib/src/icu_lld.c

+++ components/spc560dxx_low_level_drivers_component_rla/lib/src/icu_lld.c
@@ -172,6 +172,7 @@
} else if (icup->emiosp->CH[icup->ch_number].CSR.B.UCIN == 0 && \
icup->config->width_cb != NULL) {
A2_2 = icup->emiosp->CH[icup->ch_number].CADR.R;
+ A2_1 = icup->emiosp->CH[icup->ch_number].CBDR.R;
width = A2_2 - A2_1;
_icu_isr_invoke_width_cb(icup);
}
@@ -566,7 +567,7 @@
icup->emiosp->CH[icup->ch_number].CCR.B.UCPEN = 0;
icup->emiosp->CH[icup->ch_number].CCR.R |=
EMIOSC_BSL(EMIOS_BSL_INTERNAL_COUNTER) |
- EMIOSC_EDSEL | EMIOS_CCR_MODE_SAIC;
+ EMIOSC_EDSEL | EMIOS_CCR_MODE_IPWM;
icup->emiosp->CH[icup->ch_number].CCR.B.UCPRE = psc - 1;
icup->emiosp->CH[icup->ch_number].CCR.R |= EMIOSC_UCPREN;]]>

</

diff

>
</

file

>
</

files

>
</

SPC5-Patch

>

2) Strange your pinamp wizard is set on B64 not B74 Did you try to go in icu_lld_serve_interrupt and Analyse the Temp Registers ? Best Regards Erwan
aurelien23
Senior
Posted on January 22, 2016 at 16:59

Hello Erwan,

I didn't use pin wizard but the manual setting in the board init component.

For channels which are not working, the period calculated is always 1 like if the clock/counter was not activated/counting...

Any idea?

Regards