GrumpyOldPizza / arduino-STM32L4

69 stars 60 forks source link

Using PA15 of LadyBug #22

Closed clemaitre58 closed 6 years ago

clemaitre58 commented 6 years ago

I don't know if the question is for @kriswiner or @GrumpyOldPizza .

I would use the STM32L4 core to compile some code for a card which is really close to the Ladybug(L432KC microproc, dfu…). The main difference is that PA15 is route on a (nRF51)component, so I have to use it as an outpout.

My question is how or where make a change in variant.h to allow to use the PA15 pin in a sketch?

Thanks for your help.

Cédric

GrumpyOldPizza commented 6 years ago

Cedric,

not sure this is possible that easily. PA15 for Ladybug is used to detect USB_VBUS, which in turn is used to detect a USB connect event (and power up/down the USB peripheral). What GPIO do you have connected to USB_VBUS ?

On Tue, Oct 24, 2017 at 8:40 AM, Lemaitre Cédric notifications@github.com wrote:

I don't know if the question is for @kriswiner https://github.com/kriswiner or @GrumpyOldPizza https://github.com/grumpyoldpizza .

I would use the STM32L4 core to compile some code for a card which is really close to the Ladybug(L432KC microproc, dfu…). The main difference is that PA15 is route on a (nRF51)component, so I have to use it as an outpout.

My question is how or where make a change in variant.h to allow to use the PA15 pin in a sketch?

Thanks for your help.

Cédric

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfFnguaMYMPlpr_ZoWQK-6bIJAWpuks5svfavgaJpZM4QEin_ .

clemaitre58 commented 6 years ago

@GrumpyOldPizza Ok I think I understand the idea. Shift my VBUS in the place of PA15, right?

GrumpyOldPizza commented 6 years ago

Depending upon how you set it up. Create a new variant (boards.txt) and setup a new variant. In "variant.h" you need to define your USB_VBUS GPIO, and in "variant.cpp" you'd simply replace the now USB_VBUS pin by PA15.

Mind asking why you did move those pins around ?

On Tue, Oct 24, 2017 at 8:56 AM, Lemaitre Cédric notifications@github.com wrote:

@GrumpyOldPizza https://github.com/grumpyoldpizza Ok I think I understand the idea. Shift my VBUS in the place of PA15, right?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22#issuecomment-339019062, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfDp9xsjkVbooUo9HY8USRN3w8UTwks5svfqZgaJpZM4QEin_ .

clemaitre58 commented 6 years ago

In fact, I don't design the card. The guy how make this plug PA15 on nRF51. I transmit data above Serial2 when I send of Data. I place a pulse on PA15.


An other thing, I think you can add in the readme that the 32-bit support should activated for linux : sudo dpkg --add-architecture i386

If it's not the case you have some crach during compilation when you call the dfu-suffix bin.

Thanks for the help.

clemaitre58 commented 6 years ago

@GrumpyOldPizza a last question : There in the core an eeprom library.

Does this could be used for emulate eeprom in flash memory. In this manner you write on the eeprom and after a reboot you could access to the data by reading the eeprom again?

GrumpyOldPizza commented 6 years ago

The EEPROM code for STM32L4 takes a chunk of regular FLASH and emulates an EEPROM ontop. So yes, after a reboot the data is still there.

On Tue, Oct 24, 2017 at 12:12 PM, Lemaitre Cédric notifications@github.com wrote:

@GrumpyOldPizza https://github.com/grumpyoldpizza a last question : There in the core an eeprom library.

Does this could be used for emulate eeprom in flash memory. In this manner you write on the eeprom and after a reboot you could access to the data by reading the eeprom again?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22#issuecomment-339081966, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfEjEOBvQo6XIdglm5BHLFB7-AhHkks5sviiXgaJpZM4QEin_ .

clemaitre58 commented 6 years ago

@GrumpyOldPizza in the example there is some examples with address = 0. How to now where exactly in the flash point with 0 address?

TX

GrumpyOldPizza commented 6 years ago

Yes. The stanard examples come with it, documentation is on arduino.cc.

On Wed, Oct 25, 2017 at 1:20 AM, Lemaitre Cédric notifications@github.com wrote:

@GrumpyOldPizza https://github.com/grumpyoldpizza is there an example of use?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22#issuecomment-339238398, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfNibbUwedq813IH_3M6gddStMKHvks5svuFbgaJpZM4QEin_ .

clemaitre58 commented 6 years ago

@GrumpyOldPizza concerning the eeprom : when you read the address 0 of the eeprom with address of the flash is it?

TY Cédric

GrumpyOldPizza commented 6 years ago

EEPROM emulation is complex. There is no fixed mapping. What you have is a bunch of dates reserved in regular FLASH that keeps track of what values should be where in the virtual EEPROM.

On Fri, Nov 10, 2017 at 2:48 AM, Lemaitre Cédric notifications@github.com wrote:

@GrumpyOldPizza https://github.com/grumpyoldpizza concerning the eeprom : when you read the address 0 of the eeprom with address of the flash is it?

TY Cédric

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22#issuecomment-343427272, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfC8uj2pjdng5c1auOg-OLnzkM9V5ks5s1Bv_gaJpZM4QEin_ .

clemaitre58 commented 6 years ago

@GrumpyOldPizza where could I find docs or code which explained how is made this none-fixed mapping?

GrumpyOldPizza commented 6 years ago

https://github.com/GrumpyOldPizza/arduino-STM32L4/blob/master/cores/stm32l4/avr/eeprom.c

On Mon, Nov 13, 2017 at 7:31 AM, Lemaitre Cédric notifications@github.com wrote:

@GrumpyOldPizza https://github.com/grumpyoldpizza where could I find docs or code which explained how is made this none-fixed mapping?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22#issuecomment-343935813, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfFylw7y_V3vePYr0i0z_34gueDgbks5s2FKugaJpZM4QEin_ .

clemaitre58 commented 6 years ago

@GrumpyOldPizza Another stupid question : does your core configuration assume that the ladybug have an external oscilator? or you could use the internal oscillator of the STM32L432KC?

TY Cédric

GrumpyOldPizza commented 6 years ago

32768Hz is required fir the software stack as is.

On Wed, Nov 15, 2017 at 2:40 AM, Lemaitre Cédric notifications@github.com wrote:

@GrumpyOldPizza https://github.com/grumpyoldpizza Another stupid question : does your core configuration assume that the ladybug have an external oscilator? or you could use the internal oscillator of the STM32L432KC?

TY Cédric

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22#issuecomment-344538413, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfIrbTC-P9DlI7AOlPPONlNkv9OGaks5s2rGPgaJpZM4QEin_ .

clemaitre58 commented 6 years ago

@GrumpyOldPizza 32768Hz external oscillator, rigth?

GrumpyOldPizza commented 6 years ago

Yes. It's used for RTC and to lock MSI, which drives either SYSCLK directly, or throu the PLL. Otherwise you need to finetune MSI (and HSI16), which the current code does not do.

Why would you want to save on 32768Hz ?

The problem not having 32768Hz is that you cannot use LSE. You'd need to use LSI. And that is frequency wise a random generator. So you needed to measure it's frequency, with HSI16 as time base. Latter one is only tuned to about 1% precision. So you'd create overall a system where time is within +/- 2%.

On Wed, Nov 15, 2017 at 4:57 AM, Lemaitre Cédric notifications@github.com wrote:

@GrumpyOldPizza https://github.com/grumpyoldpizza 32768Hz external oscillator, rigth?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22#issuecomment-344571601, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfO2VzbwfRmhgOuidNiQY0FIO7J-iks5s2tHDgaJpZM4QEin_ .

clemaitre58 commented 6 years ago

@GrumpyOldPizza

Ok, I understand this. Is there a possibility to use MSI and HSI16 ? Is it here : https://github.com/GrumpyOldPizza/arduino-STM32L4/blob/master/system/CMSIS/Device/ST/STM32L4xx/Source/system_stm32l4xx.c

In SystemCoreClockUpdate function?

GrumpyOldPizza commented 6 years ago

MSI is used for SYSCLK (locked by LSE). HSI16 is used for USART and I2C. So I am not sure what your question is.

The SystemCoreClockUpdate function really just looks at the RCC values and from there tries to guess "SystemCoreClock". In any case this file is not in use for the code in question.

On Wed, Nov 15, 2017 at 5:56 AM, Lemaitre Cédric notifications@github.com wrote:

@GrumpyOldPizza https://github.com/grumpyoldpizza

Ok, I understand this. Is there a possibility to use MSI and HSI16 ? Is it here : https://github.com/GrumpyOldPizza/arduino- STM32L4/blob/master/system/CMSIS/Device/ST/STM32L4xx/ Source/system_stm32l4xx.c

In SystemCoreClockUpdate function?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22#issuecomment-344584178, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfJHiDVDs89yniinVkt0vvdgTmiYjks5s2t9qgaJpZM4QEin_ .

clemaitre58 commented 6 years ago

@GrumpyOldPizza

So if there is no External oscillator nothing on PC-14 ard PC-15. Does the software in the flash start properly? Does the component use a default configuration Internal clock?

GrumpyOldPizza commented 6 years ago

Software starts with 4MHz MSI. Pretty well documented in the datasheet and the reference manual. From there the code in stages goes to HSI16 and then later on to MSI+LSE.

On Wed, Nov 15, 2017 at 6:37 AM, Lemaitre Cédric notifications@github.com wrote:

@GrumpyOldPizza https://github.com/grumpyoldpizza

So if there is no External oscillator nothing on PC-14 ard PC-15. Does the software in the flash start properly? Does the component use a default configuration Internal clock?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22#issuecomment-344594168, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfCm7LUzQ8kU_O40u90B5DK8rA-W0ks5s2ukCgaJpZM4QEin_ .

clemaitre58 commented 6 years ago

So a binary for Ladybug (which haved LSE) from your core should rum perfectly (excepted the précision of the clock) on my proto which doesn't have external oscilator, rigth?

On Wed, Nov 15, 2017 at 3:20 PM, Thomas Roell notifications@github.com wrote:

Software starts with 4MHz MSI. Pretty well documented in the datasheet and the reference manual. From there the code in stages goes to HSI16 and then later on to MSI+LSE.

  • Thomas

On Wed, Nov 15, 2017 at 6:37 AM, Lemaitre Cédric <notifications@github.com

wrote:

@GrumpyOldPizza https://github.com/grumpyoldpizza

So if there is no External oscillator nothing on PC-14 ard PC-15. Does the software in the flash start properly? Does the component use a default configuration Internal clock?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22# issuecomment-344594168, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfCm7LUzQ8kU_ O40u90B5DK8rA-W0ks5s2ukCgaJpZM4QEin_ .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22#issuecomment-344606099, or mute the thread https://github.com/notifications/unsubscribe-auth/APVw04K0Od_K-kggxj1E84VHKfmLQBMKks5s2vM4gaJpZM4QEin_ .

GrumpyOldPizza commented 6 years ago

No. This STM32L4 Arduino Core REQUIRES LSE (32768Hz) to be connected and working.

On Wed, Nov 15, 2017 at 7:38 AM, Lemaitre Cédric notifications@github.com wrote:

So a binary for Ladybug (which haved LSE) from your core should rum perfectly (excepted the précision of the clock) on my proto which doesn't have external oscilator, rigth?

On Wed, Nov 15, 2017 at 3:20 PM, Thomas Roell notifications@github.com wrote:

Software starts with 4MHz MSI. Pretty well documented in the datasheet and the reference manual. From there the code in stages goes to HSI16 and then later on to MSI+LSE.

  • Thomas

On Wed, Nov 15, 2017 at 6:37 AM, Lemaitre Cédric < notifications@github.com

wrote:

@GrumpyOldPizza https://github.com/grumpyoldpizza

So if there is no External oscillator nothing on PC-14 ard PC-15. Does the software in the flash start properly? Does the component use a default configuration Internal clock?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22# issuecomment-344594168, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfCm7LUzQ8kU_ O40u90B5DK8rA-W0ks5s2ukCgaJpZM4QEin_ .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22# issuecomment-344606099, or mute the thread https://github.com/notifications/unsubscribe-auth/APVw04K0Od_K- kggxj1E84VHKfmLQBMKks5s2vM4gaJpZM4QEin_ .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/arduino-STM32L4/issues/22#issuecomment-344611709, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfEuH9MlmNGvyWonzw97Xu9TFBlJHks5s2vdmgaJpZM4QEin_ .