Having issues with usb otgv1 on STM32F723

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Having issues with usb otgv1 on STM32F723

Postby Giovanni » Sat Sep 22, 2018 11:59 am

It depends on the resolution you need, both are usable for polled delays.

The RTC macros take the frequency parameter because RT does not know about the clock frequency, only about the systick frequency. It is HAL that knows about clock settings and RT cannot depend on HAL.

@sabdulqadir

Also trying to understand what delays should be used in the LLDs.


There are RTC-like functions in OSAL, very similar to those in RT, from drivers you should use OSAL services only.

Giovanni

faisal
Posts: 374
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 44 times
Been thanked: 60 times

Re: Having issues with usb otgv1 on STM32F723

Postby faisal » Mon Sep 24, 2018 4:04 am

It also depends when you need to use the timer. For driver initialization in functions called by halInit(), you cannot depend on the RT system timer, as chSysInit() has not been called by that time.

Giovanni: I get that due to RT not depending on HAL, it cannot know the the real time count frequency, and thus cannot incorporate it into the function. However, HAL can define a symbol like CYC_CNT_CLK_FREQUENCY which use code can use. Where would be the most appropriate place to define it, and it's usage? From my point of view, it should be defined at the earliest point where there is enough information to determine it - which I think would be in hal_lld.h.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Having issues with usb otgv1 on STM32F723

Postby Giovanni » Mon Sep 24, 2018 7:19 am

Hi,

There is SystemCoreClock (exported by CMSIS header) which should work for that.

Giovanni

faisal
Posts: 374
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 44 times
Been thanked: 60 times

Re: Having issues with usb otgv1 on STM32F723

Postby faisal » Mon Sep 24, 2018 4:45 pm

Giovanni wrote:Hi,

There is SystemCoreClock (exported by CMSIS header) which should work for that.

Giovanni


But that only works if one uses the CMSIS system configuration files. From the comments in system_stm32l4xx.h (which is where SystemCoreClock is exported):

Code: Select all

/** @addtogroup STM32L4xx_System_Exported_Variables
  * @{
  */
  /* The SystemCoreClock variable is updated in three ways:
      1) by calling CMSIS function SystemCoreClockUpdate()
      2) by calling HAL API function HAL_RCC_GetSysClockFreq()
      3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
         Note: If you use this function to configure the system clock; then there
               is no need to call the 2 first functions listed above, since SystemCoreClock
               variable is updated automatically.
  */
  extern uint32_t SystemCoreClock;            /*!< System Clock Frequency (Core Clock) */
 


The stm32XXXX_hal_rcc.c/.h files define HAL_RCC_GetSysClockFreq(). The relevant files are not included in ChibiOS, and I'm not sure if they would be compatible with ChibiOS/HAL.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Having issues with usb otgv1 on STM32F723

Postby Giovanni » Mon Sep 24, 2018 5:40 pm

The assumption is that you don't use ChibiOS HAL with the ST HAL in the same project, that variable is required by CMSIS headers and we use those, our HAL defines that variable with the same meaning.

Giovanni

faisal
Posts: 374
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 44 times
Been thanked: 60 times

Re: Having issues with usb otgv1 on STM32F723

Postby faisal » Tue Sep 25, 2018 3:33 am

Giovanni wrote:The assumption is that you don't use ChibiOS HAL with the ST HAL in the same project, that variable is required by CMSIS headers and we use those, our HAL defines that variable with the same meaning.

Giovanni


Thanks Giovanni, it finally crossed the membrane into my head :) . I grep'd the source and found it defined exactly where I had hoped/expected it to be - but never bothered to actually look. Sigh.


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 4 guests