2020年11月25日 星期三

[stm32] PWM study

study 中... 

不錯的文章

Stm32f103 Pwm(Pulse width modulation) signal generation using internal timers, keil MDK-ARMv6 and Stmcubemx Ide
https://www.engineersgarage.com/stm32/stm32-pwm-generation-using-timers/

2020年11月19日 星期四

[stm32] ADC study


不錯的文章

Getting Started with STM32 - Working with ADC and DMAhttps://www.digikey.com/en/maker/projects/getting-started-with-stm32-working-with-adc-and-dma/f5009db3a3ed4370acaf545a3370c30c

【STM32CubeMX】5,STM32之ADC
https://www.itread01.com/content/1550512627.html

[stm32] SPI study

 


不錯的文章

STM32—cubeMX+HAL庫的SPI介面使用
https://www.itread01.com/content/1548978304.html

Getting Started with STM32 - How to Use SPI
https://www.digikey.com/en/maker/projects/getting-started-with-stm32-how-to-use-spi/09eab3dfe74c4d0391aaaa99b0a8ee17

2020年11月18日 星期三

[stm32] Timer study

timer1 polling:

HAL_TIM_Base_Start(&htim1);
uint16_t t1=__HAL_TIM_GET_COUNTER(&htim1);
HAL_Delay(100);
uint16_t t2=__HAL_TIM_GET_COUNTER(&htim1);
uint16_t diff=t2-t1;


timer1 isr:

HAL_TIM_Base_Start_IT(&htim1); => enable 方式不同

寫在main內的 timer callback functionvoid
 HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
// Check which version of the timer triggered this callback and toggle LED
if (htim == &htim1 )
{
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
}
}



不錯的文章:

Getting Started with STM32 - Timers and Timer Interrupts
https://www.digikey.com/en/maker/projects/getting-started-with-stm32-timers-and-timer-interrupts/d08e6493cefa486fb1e79c43c0b08cc6

[stm32] I2C study

 試著了解一下 I2C DMA.......

最後才知要呼叫 

HAL_StatusTypeDef HAL_I2C_Mem_Read_DMA ( I2C_HandleTypeDef * hi2c,
uint16_t DevAddress,
uint16_t MemAddress,
uint16_t MemAddSize,
uint8_t * pData,
uint16_t Size
)

在實作中,有發現如果是HAL_BUSY 好像I2C就當掉了,無法復原:
STM32: Busy flag is set after I2C initialization

https://electronics.stackexchange.com/questions/272427/stm32-busy-flag-is-set-after-i2c-initialization


不錯的文章:
STM32CubeIDE HAL库操作IIC (一)配置篇
https://blog.csdn.net/u010779035/article/details/104346201

STM32F439xx HAL User Manual
http://www.disca.upv.es/aperles/arm_cortex_m3/llibre/st/STM32F439xx_User_Manual/group__i2c__exported__functions__group2.html#gab25b99552182d2486d8eb441fffdd0a4

STM32 I2C Tutorial – HAL Code Examples Slave & Master – DMA Interrupt
https://deepbluembedded.com/stm32-i2c-tutorial-hal-examples-slave-dma/

2020年11月11日 星期三

[stm32] I2C study

 

一開始 clock  sources要選對,之前選 Bypass 好像有問題

在MX_I2C1_Init(0 --> HAL_I2C_Init(&hi2c1) 內會有問題

 
一直回  HAL_ERROR,選了 clock sources 就 OK了,也知是否就這樣!!!

試了如下自寫function,好像有讀到資料


成功 !!!



2020年11月8日 星期日

[C#]在偵錯模式中為 console 程式帶參數

 選取menu的 Project項目內的Properties



選擇左邊Debug項目,填入引數參數


大功告成 !!😀😀