Skip to content

Commit

Permalink
projects:ad469x_iio: Add virtual com port support
Browse files Browse the repository at this point in the history
Add virtual com support to the project

Signed-off-by: Janani Sunil <[email protected]>
  • Loading branch information
jansunil committed Nov 22, 2024
1 parent 4da0945 commit db17247
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 82 deletions.
6 changes: 4 additions & 2 deletions projects/ad469x_iio/STM32/.extSettings
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[ProjectFiles]
HeaderPath=../app;../../../libraries/no-OS/util;../../../libraries/no-OS/include;../../../libraries/no-OS/drivers/platform/stm32;../../../libraries/no-OS/iio;../../../libraries/no-OS/drivers/api;../../../libraries/precision-converters-library/board_info/;../../../libraries/precision-converters-library/common/;../../../libraries/no-OS/drivers/eeprom/24xx32a/;../../../libraries/no-OS/drivers/adc/ad469x/;
HeaderPath=../app;../../../libraries/no-OS/util;../../../libraries/no-OS/include;../../../libraries/no-OS/drivers/platform/stm32;../../../libraries/no-OS/iio;../../../libraries/no-OS/drivers/api;../../../libraries/precision-converters-library/board_info/;../../../libraries/precision-converters-library/common/;../../../libraries/no-OS/drivers/eeprom/24xx32a/;../../../libraries/no-OS/drivers/adc/ad469x/;../../../libraries/precision-converters-library/sdp_k1_sdram/;

[Groups]
app/=../app/main.c;../app/main.c;../app/ad469x_iio.c;../app/ad469x_iio.h;../app/ad469x_support.c;../app/ad469x_support.h;../app/app_config.h;../app/app_config.c;../app/app_config_stm32.c;../app/app_config_stm32.h;../app/stm32_gpio_irq_generated.c;../app/stm32_hal.h;../app/ad469x_user_config.c;../app/ad469x_user_config.h;../app/eeprom_config.c;../app/eeprom_config.h
Expand All @@ -8,13 +8,15 @@ app/libraries/precision-converters-library/board_info/=../../../libraries/precis

app/libraries/precision-converters-library/common/=../../../libraries/precision-converters-library/common/common.h;../../../libraries/precision-converters-library/common/common.c;

app/libraries/precision-converters-library/sdp_k1_sdram/=../../../libraries/precision-converters-library/sdp_k1_sdram/sdp_k1_sdram.c;../../../libraries/precision-converters-library/sdp_k1_sdram/sdp_k1_sdram.h;

app/libraries/no-OS/=../../../libraries/no-OS/util/;../../../libraries/no-OS/include;

app/libraries/no-OS/drivers/eeprom/24xx32a/=../../../libraries/no-OS/drivers/eeprom/24xx32a/24xx32a.c;../../../libraries/no-OS/drivers/eeprom/24xx32a/24xx32a.h;

app/libraries/no-OS/drivers/adc/ad469x/=../../../libraries/no-OS/drivers/adc/ad469x/ad469x.c;../../../libraries/no-OS/drivers/adc/ad469x/ad469x.h;

app/libraries/no-OS/drivers/platform/stm32/=../../../libraries/no-OS/drivers/platform/stm32/stm32_delay.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_gpio.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_gpio.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_gpio_irq.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_gpio_irq.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_spi.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_spi.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_i2c.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_i2c.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_uart.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_uart.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_delay.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_irq.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_irq.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_pwm.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_pwm.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_dma.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_dma.h;
app/libraries/no-OS/drivers/platform/stm32/=../../../libraries/no-OS/drivers/platform/stm32/stm32_delay.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_gpio.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_gpio.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_gpio_irq.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_gpio_irq.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_spi.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_spi.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_i2c.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_i2c.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_uart.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_uart.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_delay.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_irq.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_irq.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_pwm.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_pwm.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_dma.c;../../../libraries/no-OS/drivers/platform/stm32/stm32_dma.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_usb_uart.h;../../../libraries/no-OS/drivers/platform/stm32/stm32_usb_uart.c

app/libraries/no-OS/iio/=../../../libraries/no-OS/iio/iio.c;../../../libraries/no-OS/iio/iio.h;../../../libraries/no-OS/iio/iiod.h;../../../libraries/no-OS/iio/iiod.c;../../../libraries/no-OS/iio/iio_trigger.c;../../../libraries/no-OS/iio/iio_types.h;../../../libraries/no-OS/iio/iio_trigger.h;

Expand Down
210 changes: 130 additions & 80 deletions projects/ad469x_iio/STM32/ad469x_iio.ioc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ Mcu.IP0=DMA
Mcu.IP1=FMC
Mcu.IP10=TIM8
Mcu.IP11=UART5
Mcu.IP12=USB_DEVICE
Mcu.IP13=USB_OTG_HS
Mcu.IP2=I2C1
Mcu.IP3=NVIC
Mcu.IP4=RCC
Expand All @@ -79,92 +81,105 @@ Mcu.IP6=SYS
Mcu.IP7=TIM1
Mcu.IP8=TIM2
Mcu.IP9=TIM4
Mcu.IPNb=12
Mcu.IPNb=14
Mcu.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H11
Mcu.Pin59=PA5
Mcu.Pin6=PB7
Mcu.Pin60=PF14
Mcu.Pin61=PF11
Mcu.Pin62=PE9
Mcu.Pin63=PE11
Mcu.Pin64=PE14
Mcu.Pin65=PB10
Mcu.Pin66=PH8
Mcu.Pin67=PH10
Mcu.Pin68=PA3
Mcu.Pin69=PA7
Mcu.Pin7=PG15
Mcu.Pin70=PB1
Mcu.Pin71=PB0
Mcu.Pin72=PE7
Mcu.Pin73=PE10
Mcu.Pin74=PE12
Mcu.Pin75=PE15
Mcu.Pin76=PE13
Mcu.Pin77=PB11
Mcu.Pin78=PB15
Mcu.Pin79=VP_SYS_VS_Systick
Mcu.Pin8=PD0
Mcu.Pin80=VP_TIM1_VS_ClockSourceINT
Mcu.Pin81=VP_TIM2_VS_ClockSourceITR
Mcu.Pin82=VP_TIM4_VS_ControllerModeGated
Mcu.Pin83=VP_TIM4_VS_ClockSourceITR
Mcu.Pin84=VP_TIM8_VS_ControllerModeTrigger
Mcu.Pin85=VP_TIM8_VS_ClockSourceINT
Mcu.Pin86=VP_TIM8_VS_ClockSourceITR
Mcu.Pin87=VP_TIM8_VS_no_output1
Mcu.Pin88=VP_TIM8_VS_OPM
Mcu.Pin89=VP_USB_DEVICE_VS_USB_DEVICE_CDC_HS
Mcu.Pin9=PD1
Mcu.PinsNb=90
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
Mcu.UserName=STM32F469NIHx
MxCube.Version=6.12.1
MxDb.Version=DB.6.0.121
MxCube.Version=6.11.1
MxDb.Version=DB.6.0.110
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.DMA2_Stream0_IRQn=true\:0\:0\:false\:true\:false\:1\:true\:true\:true
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
Expand All @@ -175,6 +190,7 @@ NVIC.I2C1_ER_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
NVIC.I2C1_EV_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.OTG_HS_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
Expand All @@ -191,9 +207,25 @@ PA15.GPIOParameters=GPIO_Speed
PA15.GPIO_Speed=GPIO_SPEED_FREQ_VERY_HIGH
PA15.Locked=true
PA15.Signal=S_TIM2_CH1_ETR
PA3.Mode=Device_HS
PA3.Signal=USB_OTG_HS_ULPI_D0
PA5.Mode=Device_HS
PA5.Signal=USB_OTG_HS_ULPI_CK
PA7.Locked=true
PA7.Mode=Full_Duplex_Master
PA7.Signal=SPI1_MOSI
PB0.Mode=Device_HS
PB0.Signal=USB_OTG_HS_ULPI_D1
PB1.Mode=Device_HS
PB1.Signal=USB_OTG_HS_ULPI_D2
PB10.Mode=Device_HS
PB10.Signal=USB_OTG_HS_ULPI_D3
PB11.Mode=Device_HS
PB11.Signal=USB_OTG_HS_ULPI_D4
PB12.Mode=Device_HS
PB12.Signal=USB_OTG_HS_ULPI_D5
PB13.Mode=Device_HS
PB13.Signal=USB_OTG_HS_ULPI_D6
PB15.Locked=true
PB15.Signal=GPXTI15
PB3.GPIOParameters=GPIO_PuPd
Expand All @@ -204,13 +236,23 @@ PB3.Signal=SPI1_SCK
PB4.Locked=true
PB4.Mode=Full_Duplex_Master
PB4.Signal=SPI1_MISO
PB5.Mode=Device_HS
PB5.Signal=USB_OTG_HS_ULPI_D7
PB7.Locked=true
PB7.Mode=I2C
PB7.Signal=I2C1_SDA
PB8.Mode=I2C
PB8.Signal=I2C1_SCL
PC0.Mode=Device_HS
PC0.Signal=USB_OTG_HS_ULPI_STP
PC12.Mode=Asynchronous
PC12.Signal=UART5_TX
PC2.Locked=true
PC2.Mode=Device_HS
PC2.Signal=USB_OTG_HS_ULPI_DIR
PC3.Locked=true
PC3.Mode=Device_HS
PC3.Signal=USB_OTG_HS_ULPI_NXT
PD0.Signal=FMC_D2_DA2
PD1.Signal=FMC_D3_DA3
PD10.Signal=FMC_D15_DA15
Expand Down Expand Up @@ -490,6 +532,12 @@ TIM8.TIM_MasterSlaveMode=TIM_MASTERSLAVEMODE_ENABLE
UART5.BaudRate=230400
UART5.IPParameters=VirtualMode,BaudRate
UART5.VirtualMode=Asynchronous
USB_DEVICE.CLASS_NAME_HS=CDC
USB_DEVICE.IPParameters=VirtualMode-CDC_HS,VirtualModeHS,CLASS_NAME_HS
USB_DEVICE.VirtualMode-CDC_HS=Cdc
USB_DEVICE.VirtualModeHS=Cdc_HS
USB_OTG_HS.IPParameters=VirtualMode-Device_HS
USB_OTG_HS.VirtualMode-Device_HS=Device_HS
VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
VP_TIM1_VS_ClockSourceINT.Mode=Internal
Expand All @@ -510,4 +558,6 @@ VP_TIM8_VS_OPM.Mode=OPM_bit
VP_TIM8_VS_OPM.Signal=TIM8_VS_OPM
VP_TIM8_VS_no_output1.Mode=PWM Generation1 No Output
VP_TIM8_VS_no_output1.Signal=TIM8_VS_no_output1
VP_USB_DEVICE_VS_USB_DEVICE_CDC_HS.Mode=CDC_HS
VP_USB_DEVICE_VS_USB_DEVICE_CDC_HS.Signal=USB_DEVICE_VS_USB_DEVICE_CDC_HS
board=custom
1 change: 1 addition & 0 deletions projects/ad469x_iio/app/app_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
#define cs_extra_init_params stm32_cs_extra_init_params
#define tx_trigger_extra_init_params stm32_tx_trigger_extra_init_params
#define cs_pwm_gpio_extra_init_params stm32_cs_pwm_gpio_extra_init_params
#define vcom_extra_init_params stm32_vcom_extra_init_params
#else
#error "No/Invalid active platform selected"
#endif
Expand Down
8 changes: 8 additions & 0 deletions projects/ad469x_iio/app/app_config_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ uint8_t* dma_buf_current_idx;

#endif

/* STM32 VCOM init parameters */
struct stm32_usb_uart_init_param stm32_vcom_extra_init_params = {
.husbdevice = &hUsbDeviceHS,
};

/******************************************************************************/
/************************** Functions Declaration *****************************/
/******************************************************************************/
Expand Down Expand Up @@ -230,6 +235,9 @@ void stm32_system_init(void)
#else
HAL_NVIC_DisableIRQ(EXTI9_5_IRQn);
#endif
#ifdef USE_VIRTUAL_COM_PORT
MX_USB_DEVICE_Init();
#endif
}

/**
Expand Down
5 changes: 5 additions & 0 deletions projects/ad469x_iio/app/app_config_stm32.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "stm32_uart.h"
#include "stm32_pwm.h"
#include "stm32_dma.h"
#include "stm32_usb_uart.h"

/******************************************************************************/
/********************** Macros and Constants Definition ***********************/
Expand Down Expand Up @@ -67,6 +68,7 @@
#define pwm_ops stm32_pwm_ops
#define trigger_gpio_irq_ops stm32_gpio_irq_ops
#define dma_ops stm32_dma_ops
#define vcom_ops stm32_usb_uart_ops
#define trigger_gpio_handle 0 // Unused macro

/* Timer specific macros used for calculating pwm
Expand Down Expand Up @@ -147,6 +149,8 @@ extern struct stm32_dma_channel txdma_channel;
extern struct stm32_gpio_init_param stm32_cs_pwm_gpio_extra_init_params;
extern uint32_t rxdma_ndtr;
extern uint32_t dma_cycle_count;
extern USBD_HandleTypeDef hUsbDeviceHS;
extern struct stm32_usb_uart_init_param stm32_vcom_extra_init_params;

void receivecomplete_callback(DMA_HandleTypeDef* hdma);
void halfcmplt_callback(DMA_HandleTypeDef* hdma);
Expand All @@ -159,5 +163,6 @@ void stm32_timer_stop(void);
#endif

void stm32_system_init(void);
void MX_USB_DEVICE_Init(void);

#endif /* APP_CONFIG_STM32_H_ */

0 comments on commit db17247

Please sign in to comment.