After exploring WaveShare's F407 board for several days, it has been stuck in the udp module of the network card module for two days. Because the packet capture tool can't always receive the data packets sent from my code, my request is to send only specific data. Regardless of the data packet received.

Record the entire test process for later review

How to send specific data using STM32F407's UDP

Using the development board's own routines, the udp_echo_server example is modified based on this, the main function is

Int main(void)

{

/*! " At this stage the microcontroller clock setTIng is already configured to

168 MHz, this is done through SystemInit() funcTIon which is called from

Startup file (startup_stm32f4xx.s) before to branch to applicaTIon main.

To reconfigure the default setTIng of SystemInit() function, refer to

System_stm32f4xx.c file

*/

#ifdef SERIAL_DEBUG

DebugComPort_Init();

#endif

/*Initialize LCD and Leds */

LCD_LED_Init();

/* configure ethernet */

ETH_BSP_Config();

/* Initilaize the LwIP stack */

LwIP_Init();

/* UDP echoserver */

Udp_echoserver_init();

/* Infinite loop */

While (1)

{

/* check if any packet received */

If (ETH_CheckFrameReceived())

{

/* process received ethernet packet */

LwIP_Pkt_Handle();

}

/* handle periodic timers for LwIP */

LwIP_Periodic_Handle(LocalTime);

}

}

I found that the serial port can not be used, it may be some problems with its initialization method, I made some changes

Change the DebugComPort_Init function to the following two functions

USART_Configuration();

USART_NVIC_Config();

Serial 1 can be used normally

Void USART_Configuration(void)

{

GPIO_InitTypeDef GPIO_InitStructure;

USART_InitTypeDef USART_InitStructure;

RCC_AHB1PeriphClockCmd(Open_USART_TX_GPIO_CLK,ENABLE);

RCC_AHB1PeriphClockCmd(Open_USART_RX_GPIO_CLK,ENABLE);

#ifdef USART1_OPEN

RCC_APB2PeriphClockCmd(Open_USART_CLK,ENABLE);

#else

RCC_APB1PeriphClockCmd(Open_USART_CLK,ENABLE);

#endif

GPIO_PinAFConfig(Open_USART_TX_GPIO_PORT, Open_USART_TX_SOURCE, Open_USART_TX_AF);

GPIO_PinAFConfig(Open_USART_RX_GPIO_PORT, Open_USART_RX_SOURCE, Open_USART_RX_AF);

/*

* Open_USART_TX -" PA9, Open_USART_RX -PA10

*/

GPIO_InitStructure.GPIO_Pin = Open_USART_TX_PIN;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

GPIO_InitStructure.GPIO_Speed ​​= GPIO_Speed_50MHz;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;

GPIO_Init(Open_USART_TX_GPIO_PORT, &GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = Open_USART_RX_PIN;

GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;

GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

GPIO_Init(Open_USART_RX_GPIO_PORT, &GPIO_InitStructure);

/*

USARTx configured as follow:

- BaudRate = 115200 baud

- Word Length = 8 Bits

- One Stop Bit

- No parity

- Hardware flow control disabled (RTS and CTS signals)

- Receive and transmit

*/

USART_InitStructure.USART_BaudRate = 115200;

USART_InitStructure.USART_WordLength = USART_WordLength_8b;

USART_InitStructure.USART_StopBits = USART_StopBits_1;

USART_InitStructure.USART_Parity = USART_Parity_No;

USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

USART_Init(Open_USART, &USART_InitStructure);

/* Enable the Open_USART Transmit interrupt: this interrupt is generated when the

Open_USART transmit data register is empty */

USART_ITConfig (Open_USART, USART_IT_RXNE, ENABLE);

USART_Cmd(Open_USART, ENABLE);

}

Void USART_NVIC_Config(void)

{

NVIC_InitTypeDef NVIC_InitStructure;

/* Enable the USARTx Interrupt */

NVIC_InitStructure.NVIC_IRQChannel = Open_USART_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

}

Then comment out udp_echoserver_init();

Add a function inside while(1)

Udp_send_data(udp_data, sizeof(udp_data));

The code is

Unsigned char udp_data[]= "hello world!";

Void udp_send_data(uint8_t* pData, uint16_t len)

{

Struct udp_pcb *upcb;

Struct pbuf* buff;

Struct ip_addr ipaddr;

Err_t err;

Buff = pbuf_alloc(PBUF_TRANSPORT, 1024, PBUF_ROM);

Buff-"payload = pData;

Buff-"len = len;

Buff-"tot_len = len;

Upcb = udp_new() ;// Create a new UDP packet

Udp_bind(upcb, IP_ADDR_ANY, 7);

IP4_ADDR(&ipaddr, 192, 168, 1, 11); // Remember that the IP here is the IP of the PC because the PC's packet software is used to receive it.

Err = udp_connect(upcb, &ipaddr, 7);

If(err == ERR_OK)

{

Err = udp_send(upcb, buff);

If(ERR_IS_FATAL(err))

Printf("udp_send...%d",err);

}

Udp_disconnect(upcb);

Pbuf_free(buff);

Udp_remove(upcb);

}

The final main function is

Int main(void)

{

USART_Configuration();

USART_NVIC_Config();

/*Initialize LCD and Leds */

LCD_LED_Init();

/* configure ethernet */

ETH_BSP_Config();

/* Initilaize the LwIP stack */

LwIP_Init();

/* UDP echoserver */

//udp_echoserver_init();

/* Infinite loop */

While (1)

{

Udp_send_data(udp_data, sizeof(udp_data));

//Delay(100);

/* check if any packet received */

If (ETH_CheckFrameReceived())

{

/* process received ethernet packet */

LwIP_Pkt_Handle();

}

/* handle periodic timers for LwIP */

LwIP_Periodic_Handle(LocalTime);

}

}

note

The udp_send_data function inside the ip, at first I was set up here as IP IP development board, and later did not expect this is a problem, so the packet capture tool has been unable to cut data, and then single-step debugging found The udp_recv callback function udp_echoserver_receive_callback structure udp_pcb remote_ip of the upcb has always been the IP of the PC side to remember this problem.

CBD Pod System

A new rule from the Drug Enforcement Administration (DEA) threatens to upend the American hemp industry, and could even result in criminal prosecutions for manufacturers of CBD and delta-8 THC products.


The DEA says the [interim final rule," issued Aug. 20, is simply a matter of adjusting its own regulations to account for changes to the Controlled Substances Act that were mandated by the 2018 Farm Bill (or Agricultural Improvement Act) that legalized hemp and CBD production. The new rule [merely conforms DEA`s regulations to the statutory amendments to the CSA that have already taken effect," says the agency. The new rule doesn`t break any ground, according to the DEA.


But many experts on cannabis and hemp law say the DEA rule creates a potential pathway the law enforcement agency could use to prosecute hemp processors and producers of CBD (cannabidiol) and delta-8 THC (or Δ8THC) products. There are two issues: partially processed CBD, and [synthetically derived" delta-8 THC.

Cbd Pod System Oem,Cbd Vape Pod Oem,Best Cbd Pod System,Cbd Pod System

Shenzhen MASON VAP Technology Co., Ltd. , https://www.e-cigarettefactory.com