cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32f030f4 and ds2401 ID chip onewire communication

pm_brk_pm
Associate II
Posted on January 17, 2017 at 08:36

Hello everyone,

I started new project that consist of ds2401 and stm32f030f4.I use Cubemx and hal drivers for this project.

Basically ? just would like to use onewire communication to read data from this ID chip.Therefore I tried to add TM drivers from this webside and this library is used for stm32f4 series.I just wanted to migrate it for f0 series but unfortunately ? was not able to add this libraries.

Is there anyway to make them work in my microcontroller.

Here is an example for onewire connection and the libarary is available below of this page : 

https://stm32f4-discovery.net/2014/05/library-12-onewire-library-for-stm43f4xx/

 

here is my projectview

0690X00000603YoQAI.jpg

On the left side I added TM drivers , But after build I get following errors;

../Drivers/STM32F0xx_HAL_Driver/Inc/tm_stm32_delay.h(185): error: &sharp20: identifier ''DWT'' is undefined

uint32_t start = DWT->CYCCNT;

..\Drivers\STM32F0xx_HAL_Driver\Src\tm_stm32_delay.c(47): error: &sharp20: identifier ''CoreDebug'' is undefined

CoreDebug->DEMCR &= ~0x01000000;

..\Drivers\STM32F0xx_HAL_Driver\Src\tm_stm32_delay.c(51): error: &sharp20: identifier ''DWT'' is undefined

#onewire #ds2401 #stm32f030f4 #hal-drivers
5 REPLIES 5
Uwe Bonnes
Principal III
Posted on January 17, 2017 at 11:04

It seem the library uses the DWT counter for delays. F0 does not implement the DWT, so you need another way to implement the One-Wire primitives. Using the Usart is one way to go.

Imen.D
ST Employee
Posted on January 17, 2017 at 14:27

Hello

ohayo.John

,

You can take as reference this

http://www.st.com/content/ccc/resource/technical/document/application_note/cd/33/56/56/87/13/46/25/DM000248pdf/files/DM000248pdf/jcr:content/translations/en.DM000248pdf

, it help you

to determine differences between the two seriesandanalyze the steps you need to migrate,

withgive attention to the peripheralcompatibility.

You have a list of 'Getting started with STM32F0' documents that may help you to start your project.

Also, you

may start from the template project in the STM32CubeF0 firmware package and then add your own modifications.

Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on January 17, 2017 at 15:36

I'd recommend benchmarking a spin loop, in the form

volatile int i = 10000;

while(i--);

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
pm_brk_pm
Associate II
Posted on February 02, 2017 at 10:03

Unfortunately there is no migration application between f0 and f4 series.I still have same error.

Is there any Onewire library available for stm32f0 series?

Posted on February 02, 2017 at 15:16

You have one timing routine to fix, is there a reason you can't just fix that?

Calibrate a loop, or use a free-running TIM

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..