友善之臂mini2440 运行uart裸板程序失败

用的板子是友善之臂mini2440,自己学习韦东山的一期视频,在写uart裸板程序时发现怎么都无法实现功能

s3c2440.h

/* GPIO寄存器 */
#define GPBCON              (*(volatile unsigned int*)0x56000010)
#define GPGCON              (*(volatile unsigned int*)0x56000060)
#define GPHCON              (*(volatile unsigned int*)0x56000070)


#define GPBDAT              (*(volatile unsigned int*)0x56000014)
#define GPGDAT              (*(volatile unsigned int*)0x56000064)

#define GPHUP               (*(volatile unsigned int*)0x56000078)

/* UART寄存器 */
#define UCON0               (*(volatile unsigned int*)0x50000004)
#define UBRDIV0             (*(volatile unsigned int*)0x50000004)
#define ULCON0              (*(volatile unsigned int*)0x50000028)
#define UTRSTAT0            (*(volatile unsigned int*)0x50000010)
#define UTXH0               (*(volatile unsigned char*)0x50000020)
#define URXH0               (*(volatile unsigned char*)0x50000024)
#define UFCON0              (*(volatile unsigned int*)0x50000008)
#define UMCON0              (*(volatile unsigned int*)0x5000000C)

#define UCON1               (*(volatile unsigned int*)0x50004004)
#define UBRDIV1             (*(volatile unsigned int*)0x50004028)
#define ULCON1              (*(volatile unsigned int*)0x50004000)
#define UTRSTAT1            (*(volatile unsigned int*)0x50004010)
#define UTXH1               (*(volatile unsigned char*)0x50004020)
#define URXH1               (*(volatile unsigned char*)0x50004024)
#define UFCON1              (*(volatile unsigned int*)0x50004008)
#define UMCON1              (*(volatile unsigned int*)0x5000400C)

uart.h

#ifndef _UART_H
#define _UART_H

void uart0_init();

int putchar(int c);

int getchar(void);

int puts(const char *s);
#endif

uart.c

#include "s3c2440.h"


/* 设置引脚用于串口 */
void uart0_init()
{

    GPHCON &= ~((3<<8)|(3<<10));    //清空GPH2,GPH3
    GPHCON |= ((2<<8)|(2<<10));     //GPH4,GPH5用于TXD1,RXD1
    GPHUP &= ~((1<<4)|(1<<5));      //使能内部上拉
    UFCON0  = 0x00;                 //不使用FIFO
    UMCON0  = 0x00;                 //不使用流控
    ULCON0 = 0x00000003;            //设置数据格式8n1:8位数据位,无校验位,1停止位
    UCON0 = 0x00000005;             //PCLK,中断/查询模式
    UBRDIV0 = 26;                   //设置波特率 115200

}


int putchar(int c)
{
    while(!(UTRSTAT0) & (1<<2))
    UTXH0 = (unsigned char)c;
}

int getchar(void)
{
    while(!(UTRSTAT0) & (1<<0))
    return URXH0;
}

int puts(const char *s)
{
    while(*s)
    {
        putchar(*s);
        s++;
    }
}

main.c

#include "s3c2440.h"
#include "uart.h"

int main(void)
{
    unsigned char c;
    uart0_init();
    puts("hello,world!\n");

    while(1)
    {
        c = getchar();
        putchar(c);
    }
    return 0;
}

start.S

.text
.global _start

_start:
    /*设置内存:sp 栈*/
    ldr sp,=4096 /*nand启动*/

    /* 关闭看门狗 */
    ldr r0, =0x53000000 
    ldr r1, =0
    str r1, [r0]

    /* 设置CPU工作于异步模式 */
    mrc  p15,0,r0,c1,c0,0 
    orr  r0,r0,#0xc0000000 //R1_nF:OR:R1_iA 
    mcr  p15,0,r0,c1,c0,0 

    /* 设置MPLL,FCLK */
    /* CLKDIVN(0x4c000014) = 0x5 */
    ldr r0, =0x4c000014
    ldr r1, =0x5            /* HCLK = FCLK/4 = 100 MHz , PCLK = HCLK/2 = 50MHz */
    str r1, [r0]



    /* 设置MPLLCON(0x4c000004) = (92<<12)|(1<<4)|(1<<0)     FCLK = 400 MHz*/
    ldr r0, =0x4c000004
    ldr r1, =(92<<12)|(1<<4)|(1<<0)
    str r1,[r0]

    /*调用main*/
    bl main

halt:
    b halt

Makefile

all:
    arm-linux-gcc -c -o uart.o uart.c
    arm-linux-gcc -c -o main.o main.c
    arm-linux-gcc -c -o start.o start.S
    arm-linux-ld -Ttext 0 start.o uart.o main.o -o uart.elf
    arm-linux-objcopy -O binary -S uart.elf uart.bin
    arm-linux-objdump -D uart.elf > uart.dis

clean:
    rm *.bin *.o *.elf *.dis

程序写完后扔到虚拟机里编译生成.bin文件,之后用友善之臂自己编写的下载工具进行烧写
图片说明

之后选择nand启动,连接串口,并没有看到返回字符串hello,world!

特来请教

1个回答

不好意思,居然被禁言了,总之仔细比对 程序,管脚,上位机的配置。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
合泰串口配置过程中出现的问题
在写好的配置函数中,用LED1(PA14)和LED2(PA15)进行测试 如果函数正常,则两灯熄灭 static void USARTx_Config() { /*USART初始化 *波特率:115200 *字节长度:8位 *停止位:1位 *校验位:无 *模式:正常模式 **/ USART_InitTypeDef USART_InitStructure; 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_Mode = USART_MODE_NORMAL; GPIO_SetOutBits(HT_GPIOC,GPIO_PIN_14); //PC14引脚置高,LED1熄灭 USART_Init(HT_USART0 , &USART_InitStructure); GPIO_SetOutBits(HT_GPIOC,GPIO_PIN_15); //PC15引脚置高,LED2熄灭 /* 设置USART中断标志 */ USART_IntConfig(HT_USART0 ,USART_INT_RXDR ,ENABLE); /* 使能USART接收、发送 */ USART_TxCmd(HT_USART0 ,ENABLE); USART_RxCmd(HT_USART0 ,ENABLE); /* 中断初始化 */ NVIC_EnableIRQ(USART0_IRQn); } 然而现象为LED1熄灭,而LED2依然亮起 显然程序卡死在 “USART_Init” 函数中 这个函数是官方库给的 void USART_Init(HT_USART_TypeDef* USARTx, USART_InitTypeDef* USART_InitStruct) { /* Check the parameters */ Assert_Param(IS_USART(USARTx)); Assert_Param(IS_USART_BAUDRATE(USART_InitStruct->USART_BaudRate)); Assert_Param(IS_USART_WORD_LENGTH(USART_InitStruct->USART_WordLength)); Assert_Param(IS_USART_STOPBITS(USART_InitStruct->USART_StopBits)); Assert_Param(IS_USART_PARITY(USART_InitStruct->USART_Parity)); Assert_Param(IS_USART_MODE(USART_InitStruct->USART_Mode)); USARTx->CR = (USARTx->CR & CR_CLEAR_Mask) | USART_InitStruct->USART_StopBits | USART_InitStruct->USART_WordLength | USART_InitStruct->USART_Parity | USART_InitStruct->USART_Mode; #if (!LIBCFG_NO_USART0) if (USARTx == HT_USART0) USARTx->DLR = CKCU_GetPeripFrequency(CKCU_PCLK_USART0) / (u32)USART_InitStruct->USART_BaudRate; #endif #if (LIBCFG_USART1) if (USARTx == HT_USART1) USARTx->DLR = CKCU_GetPeripFrequency(CKCU_PCLK_USART1) / (u32)USART_InitStruct->USART_BaudRate; #endif if (USARTx == HT_UART0) USARTx->DLR = CKCU_GetPeripFrequency(CKCU_PCLK_UART0) / (u32)USART_InitStruct->USART_BaudRate; #if (LIBCFG_UART1) if (USARTx == HT_UART1) USARTx->DLR = CKCU_GetPeripFrequency(CKCU_PCLK_UART1) / (u32)USART_InitStruct->USART_BaudRate; #endif #if (LIBCFG_UART2) if (USARTx == HT_UART2) USARTx->DLR = CKCU_GetPeripFrequency(CKCU_PCLK_UART2) / (u32)USART_InitStruct->USART_BaudRate; #endif #if (LIBCFG_UART3) if (USARTx == HT_UART3) USARTx->DLR = CKCU_GetPeripFrequency(CKCU_PCLK_UART3) / (u32)USART_InitStruct->USART_BaudRate; #endif } 现在搞不清楚程序为何会卡死在这里
stm8超声波测距为什么测的距离一直没有改变
#include <iostm8s103f3.h> #define uint unsigned int #define uchar unsigned char #define ulong unsigned long #define Echo PC_IDR_IDR6 #define Trig PC_ODR_ODR5 float distance; void delay_ms(uint ms) //延时函数{ uint i,j; for(i=0;i<ms;i++) for(j=0;j<3164;j++); } void IO() //IO初始化 { PB_DDR_DDR5=0; //PB4配置为输入 PB_CR1_C15=1; //PB4为上拉电阻输入 PB_CR2_C25=0; PC_DDR_DDR6=0; PC_CR1_C16=1; PC_CR1_C16=0; } void uart1_init(void) //串口初始化 { UART1_CR1=0x00; UART1_CR2=0x00; UART1_CR3=0x00; UART1_BRR2 = 0x03; UART1_BRR1 = 0x68; //9600波特率 UART1_CR2_TEN = 1; //允许发送 UART1_CR2_REN = 1; //允许接收 UART1_CR2_RIEN = 1; //接收中断使能 } void uart1_send(uchar dat) //串口发送{ while((UART1_SR & 0x80)==0x00); UART1_DR = dat; } void timer_Init(void) { TIM1_PSCRH = 0; TIM1_PSCRL = 15; //(15+1)分频为1M TIM1_ARRH = 0x0; TIM1_ARRL = 0x32; //每50us中断一次 TIM1_CCMR1_OC1M = 6; //pwm模式2 TIM1_CCER1_CC1E = 1; //CC1引脚使能 TIM1_CCR1H = 0; TIM1_CCR1L = 0; //默认输出低 TIM1_BKR |= 0x80; //设置刹车寄存器 TIM1_IER = 0x01; //允许更新中断 TIM1_CR1 = 0x01; //计数器使能,开始计数} /****千位数上的每一位数的读取*****/void uart1_int(uint distance) { char bai,shi,ge; bai=distance%100; shi=distance/10%10; ge=distance%10; uart1_send(bai+48); uart1_send(shi+48); //0x30对应的字符是‘0‘,数字加上0X30后为数字所对应的Ascall码 uart1_send(ge+48); uart1_send(0x0a); //0X0a对应的字符是换行\n} /*********** 定时器计数 ***********/void calc(){ //0..034cm/us int t=0; t=TIM1_CCR1H*256+TIM1_CCR1L; distance=t*0.017; TIM1_CCR1H = 0; TIM1_CCR1L = 0; uart1_int(distance); } void Trigger() { Trig=1; TIM1_ARRH = 0x0; TIM1_ARRL = 0x32; Trig=0;} void main(void){ CLK_CKDIVR &=0xe7; //配置时钟为16MHz asm("sim"); //关总中断 IO(); //IO uart1_init(); timer_Init(); asm("rim"); //开总中断 while(1) { Trigger(); //发送触发信号 while(Echo) TIM1_CR1 = 0x01; //启动定时器 while(!Echo) TIM1_CR1 = 0x00; //关闭定时器 calc(); //计算 uart1_send(0x0a); }}#pragma vector = UART1_R_RXNE_vector__interrupt void uart1rxd(void){ UART1_SR_RXNE = 0; //data = UART1_DR;} #pragma vector = TIM1_OVR_UIF_vector__interrupt void TIM1_OVR_UIF(void){ TIM1_SR1_UIF = 0; //add your code here}
ESP8266与STC89C51单片机通信,为什么单片机可以向ESP8266发送AT指令,但ESP8266发送的数据单片机接收不到?
最近学习APP与单片机通过ESP8266通信,ESP8266做服务器,APP能将数据发送到ESP8266,但ESP8266不能发送给单片机,请各位大佬帮忙解答一下。下面是代码。万分感谢 ``` void UartConfiguration() { TMOD |=0x20; //方式2 TH1=0xfd; //波特率9600 TL1=0xfd; // PCON=0x00; //波特率不加倍 SCON=0x50; // EA=1; // ES=1; // TR1=1; // TI=1; } void connect_init() { printf("AT+CIPMUX=1\r\n"); DelayMs(30000); printf("AT+CIPSERVER=1,8080\r\n"); } //重写putchar() char putchar(char ch) { ES=0; SBUF=ch; while(TI==0); TI=0; ES=1; return 0; } void ESP8266_init() { UartConfiguration(); TI=0; //等待发送完成 connect_init(); } void ESP_UART() interrupt 4 { static uchar i=0; if(RI==1) { RI=0; Recive_table[i]=SBUF; led3 = ~led3; sendByte(Recive_table[i]); i++; if((Recive_table[i-1]=='\n')) { Recive_table[i]='\0'; i=0; } } else TI=0; } ```
菜鸡求教,本人用stm32f103做串口通讯实验,接收时出现数据丢失。
任务是用stm32f103向一块超声波模块发送一个16进制指令 内容为55 aa 01 01 01 01 模块返回一个55 aa 01 01 xx xx xx的数据(xx为测量数据) 结果是串口监视串口显示打印接收到的数据只有55 aa(本应该是55 aa 01 01 xx xx xx的数据) ![图片说明](https://img-ask.csdn.net/upload/201912/18/1576657506_250765.png) 经过检查模块确实发送了7个16进制数回来,但为啥单片机只收到两个呢? 跪求大佬帮忙! 具体代码为 ``` u8 rece[100]; u16 dist=0; u8 relen=0; int main(void) { u8 t=0; u8 send[6]; u8 len=sizeof(send); send[0]=0x55; send[1]=0xaa; send[2]=0x01; send[3]=0x01; send[4]=0x01; send[5]=0x01; delay_init(); LED_Init(); KEY_Init(); BEEP_Init(); uart_init1(9600); uart_init2(9600); TIM3_PWM_Init(7199,9); TIM_SetCompare2(TIM3,4700); NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); while(1){ for(t=0;t<len;t++){ USART_SendData(USART1,send[t]); while(USART_GetFlagStatus(USART1,USART_FLAG_TC)!=SET); } LED0=0; LED1=1; delay_ms(1000); //printf("\r\ndist=%d \r\n",dist); } } void USART1_IRQHandler(void){ u8 res; if(USART_GetITStatus(USART1,USART_IT_RXNE)){ res= USART_ReceiveData(USART1); printf("\r\nres=%x ",res); } } ```
开启UART1为什么要把开启时钟放最前。
![图片说明](https://img-ask.csdn.net/upload/201911/19/1574135459_978409.png) 为什么放在开头就行 ![图片说明](https://img-ask.csdn.net/upload/201911/19/1574135485_643964.png) 放在下面的话打印出来按复位键,开头有时候会多出现一个?。
mini2440与pc串口通信问题
下面的代码用来接收pc发送的数据并且打印,大神能看看问题在哪里吗?用的USB转串口线连接的: 代码: /****************** Name:uart.c Author:xiaohu Date:2015/3/7 Descript:communicate by uart ********************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <errno.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <termios.h> //设置串口的速率、数据位、奇偶校验位、停止位 int set_opt(int fd,int nSpeed, int nBits, char nEvent, int nStop) { struct termios newtio,oldtio; if ( tcgetattr( fd,&oldtio) != 0) { perror("SetupSerial 1"); return -1; } bzero( &newtio, sizeof( newtio ) ); newtio.c_cflag |= CLOCAL | CREAD; newtio.c_cflag &= ~CSIZE; switch( nBits ) { case 8: newtio.c_cflag |= CS8; break; } switch( nEvent ) { case 'O': //奇校验 newtio.c_cflag |= PARENB; newtio.c_cflag |= PARODD; newtio.c_iflag |= (INPCK | ISTRIP); break; case 'E': //偶校验 newtio.c_iflag |= (INPCK | ISTRIP); newtio.c_cflag |= PARENB; newtio.c_cflag &= ~PARODD; break; case 'N': //无校验 newtio.c_cflag &= ~PARENB; break; } switch( nSpeed ) { case 9600: cfsetispeed(&newtio, B9600); cfsetospeed(&newtio, B9600); break; case 115200: cfsetispeed(&newtio, B115200); cfsetospeed(&newtio, B115200); break; default: cfsetispeed(&newtio, B9600); cfsetospeed(&newtio, B9600); break; } if( nStop == 1 ) { newtio.c_cflag &= ~CSTOPB; } else if ( nStop == 2 ) { newtio.c_cflag |= CSTOPB; } newtio.c_cc[VTIME] = 0; newtio.c_cc[VMIN] = 0; tcflush(fd,TCIFLUSH); if((tcsetattr(fd,TCSANOW,&newtio))!=0) { perror("com set error"); return -1; } printf("set done!\n"); return 0; } //根据串口文件描述符打开相应的串口端口 int open_port(int fd,int comport) { char *dev[]={"/dev/ttySAC0","/dev/ttySAC1","/dev/ttySAC2"}; long vdisable; if (comport==1) { fd = open( "/dev/ttySAC0", O_RDWR|O_NOCTTY|O_NDELAY); if (-1 == fd) { perror("Can't Open Serial Port0"); return(-1); } else { printf("open ttySAC0 .....\n"); } } else if(comport==2) { fd = open( "/dev/ttySAC1", O_RDWR|O_NOCTTY|O_NDELAY); if (-1 == fd) { perror("Can't Open Serial Port1"); return(-1); } else { printf("open ttySAC1 .....\n"); } } else if (comport==3) { fd = open( "/dev/ttySAC2", O_RDWR|O_NOCTTY|O_NDELAY); if (-1 == fd) { perror("Can't Open Serial Port2"); return(-1); } else { printf("open ttySAC2 .....\n"); } } if(fcntl(fd, F_SETFL, 0)<0) { printf("fcntl failed!\n"); } else { printf("fcntl=%d\n",fcntl(fd, F_SETFL,0)); } if(isatty(STDIN_FILENO)==0) { printf("standard input is not a terminal device\n"); } else { printf("isatty success!\n"); } printf("fd-open=%d\n",fd); return fd; } //写数据到相应串口 int write_to_com(int fd, const void *buf, int count) { int ret = -1; ret = write(fd,buf,count); if(ret == -1) { perror("write to com error"); } return ret; } //从相关串口读取数据 int read_from_com(int fd, void *buf, int count) { int ret = -1; ret = read(fd,buf,count); if(ret == -1) { perror("read from com error"); } return ret; } int main(void) { int com_fd,j=0; int i; char buff_read[64]; if((com_fd=open_port(com_fd,2))<0) //change where necessary! { perror("open_port error"); return; } if((i=set_opt(com_fd,4800,8,'N',2))<0) { perror("set_opt error"); return; } printf("fd=%d\n",com_fd); while(1) { memset(buff_read,0,sizeof(buff_read)); i=read_from_com(com_fd,buff_read,64); sleep(1); printf("%s",buff_read); // printf("i:%d\n",i); } return 0; } ![![![图片说明](https://img-ask.csdn.net/upload/201511/23/1448268221_450379.jpg)图片说明](https://img-ask.csdn.net/upload/201511/23/1448268311_3930.jpg)图片说明](https://img-ask.csdn.net/upload/201511/23/1448268301_879195.jpg)
stm8 的tim2 ch3通道 PA口,进行捕捉,无法进入中断?求解答?
tim2 ch3通道 初始化 void TIMER2_Catch_Init(void) { TIM2_CNTRH = 0x00;//清零计数器高8位 TIM2_CNTRL = 0x00;//清零计数器低8位 TIM2_PSCR = 0x10;//计数器时钟分频低8位16分频 TIM2_CCER2_CC3E=0;//关闭捕获功能 TIM2_CCMR3 =0x01;//滤波为0,分频为0,直接接到端口上 TIM2_CCER2_CC3P=1;//上升沿时发生捕获 TIM2_IER_CC3IE=1;//开启捕获中断 TIM2_CCER2_CC3E=1;//使能捕获功能 TIM2_CR1_CEN=1;//开启计数 } 中断函数: u16 vsync_cap_data_old,vsync_cap_data_new,vsync_period; u8 isCaptureOver; #pragma vector=0x10 __interrupt void TIM2_CAP_COM_IRQHandler(void) { if(TIM2_SR1_CC3IF) { TIM2_SR1_CC3IF = 0;//清除中断标志位 if(vsync_cap_data_old == 0x00) {//第一次捕获中断来临 vsync_cap_data_old = TIM2_CCR3H;//先读取高8位数据 vsync_cap_data_old = (unsigned int)(vsync_cap_data_old<<8) + TIM2_CCR3L;//再读取低8位数据 } else { //第二次捕获中断来临 vsync_cap_data_new = TIM2_CCR3H;//先读取高8位数据 vsync_cap_data_new = (unsigned int)(vsync_cap_data_new<<8) + TIM2_CCR3L;//再读取低8位数据 TIM2_IER_CC3IE=0;//关闭捕获中断 TIM2_CR1_CEN=0;//关闭计数 if(vsync_cap_data_new > vsync_cap_data_old) vsync_period = (vsync_cap_data_new - vsync_cap_data_old); else vsync_period = 0xFFFF + vsync_cap_data_new - vsync_cap_data_old; vsync_cap_data_old = 0x00; isCaptureOver = 1; } } } 主函数: if(isCaptureOver == 1) { //如果捕获完成则对数据进行处理 TIM2_CNTRH = 0x00;//清零计数器高8位 TIM2_CNTRL = 0x00;//清零计数器低8位 TIM2_IER_CC3IE=1;//开启捕获中断 TIM2_CR1_CEN=1;//开启计数 UART1_Send_nBit(vsync_period); isCaptureOver =0; }
小白学习写51单片机串口通信控制led闪烁频率,死循环了怎么破?
额,想用while写小灯循环,可是发现这样写直接进死循环了,没有返回值,也就改变不了频率了。求助求助 ```#include<reg52.h> #include<intrins.h> typedef unsigned char u8; typedef unsigned int u16; u8 i; sbit led=P0^0; void delay(u16 a) { while(a--); } void UsartInit() { SCON=0X50; TMOD=0X20; PCON=0X80; TH1=0XF3; TL1=0XF3; ES=1; EA=1; TR1=1; } void Uart() interrupt 4 { u8 receiveData; i=SBUF; switch(i) { case'0':led=0;break; case'1':led=1;break; case'2': { while(1) { led=0; delay(45000); led=1; delay(45000); } break; } case'3': { while(1) { led=0; delay(25000); led=1; delay(25000); } break;} case'4': { while(1) { led=0; delay(15000); led=1; delay(15000); } break; } } receiveData=SBUF; RI=0; SBUF=receiveData; while(!TI); TI=0; } void main() { UsartInit(); while(1); } ```
想在MT7620a上扩展uart口,发现正常使能了uart口,但是还是不能正常使用
最近新买的MT7620a开发板,看芯片的资料,发现有uartlite和uart两个串口,默认的boot口是uartlite,想扩展uart口用于串口通信,根据文档修改了mt7620a.dtsi和MT7620a.dts两个文件,发现boot打印出来的信息好像已经正常将io/uart复用口使能为uart了,但是通过测试还是不能使用,用示波器测量,发现一直为高电平,求大神指导!! 附上我的mt7620a.dtsi文件:
NodeMCU刷完固件刚连接上ESPlorer就提示这个 是什么问题
![图片说明](https://img-ask.csdn.net/upload/201911/10/1573368725_334567.png) NodeMCU ``` 3.0.0.0 built on nodemcu-build.com provided by frightanic.com branch: master commit: 310faf7fcc9130a296f7f17021d48c6d717f5fb6 release: 3.0-master_20190907 release DTS: 201909070945 SSL: true build type: integer LFS: 0x0 modules: cron,file,gpio,http,mqtt,net,node,pwm,sjson,tmr,uart,wifi,tls build 2019-11-10 03:53 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e) lua: init.lua:5: bad argument #1 to 'config' (config table not found!) stack traceback: [C]: in function 'config' init.lua:5: in main chunk [C]: ? >
430F5438A的UART3串行通信程序一直跑不通,不知哪里出问题了,菜鸟求救
#include "MSP430F5438A.h" void init_clock(void); void init_uart3(void); void main(void) { WDTCTL = WDTPW + WDTHOLD; init_clock(); init_uart3(); __bis_SR_register(LPM0_bits + GIE); //enter LPM0,interrupt enabled __no_operation(); } void init_clock(void) { unsigned int i; WDTCTL = WDTPW + WDTHOLD; P11DIR = BIT0 + BIT2 + BIT4; P11SEL |=BIT0 + BIT2 + BIT4; P5SEL |=0x0C;//director:选择外部时钟(port select XT2) UCSCTL6 &=~ XT2OFF; //director:enable XT2 if not used UCSCTL3 |= SELREF_2; //director:FLLref = REFO UCSCTL4 |= SELA__XT2CLK;//director:ACLK from XT2 4M UCSCTL4 |= SELS_5 + SELM_5;//director:SMCLK=MCLK=XT2=4M _NOP(); UCSCTL5 = DIVM_2 + DIVS_4 + DIVA_4;//director:XT2-4M,SMCLK-1M,ACLK-1M; do { UCSCTL7 &=~ (XT2OFFG + XT1LFOFFG + DCOFFG);//clear XT2,XT1,DCO fault flags SFRIFG1 &=~ OFIFG;//director:Clear fault flags for(i=0;i<0xFFFF;i++);//director:wait for Osc to stabilize }while(SFRIFG1&OFIFG);//director:test Osc fault flag }
sr501没有办法拉高电平
手在前面晃,只能输出低电平,无法拉高IO #include "stm32f4xx.h" #include "led.h" #include "delay.h" //#include "beep.h" #include "usart.h" int main(void) { delay_init(156); uart_init(115200); // beep_Init(); LED_Init(); while(1) { if(L_XHG==1) { LED=0; printf("true\r\n"); } if(L_XHG==0) { LED=1; printf("error"); delay_ms(100); } } } #include "led.h" #include "stm32f4xx.h" void LED_Init(void) { GPIO_InitTypeDef GPIO_Initstrtype; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF,ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE); GPIO_Initstrtype.GPIO_Mode=GPIO_Mode_OUT; GPIO_Initstrtype.GPIO_OType=GPIO_OType_PP; GPIO_Initstrtype.GPIO_Pin=GPIO_Pin_9; GPIO_Initstrtype.GPIO_PuPd=GPIO_PuPd_UP; GPIO_Initstrtype.GPIO_Speed=GPIO_Speed_100MHz; GPIO_Init(GPIOF,&GPIO_Initstrtype); GPIO_Initstrtype.GPIO_Mode=GPIO_Mode_IN; GPIO_Initstrtype.GPIO_Pin=GPIO_Pin_0; GPIO_Initstrtype.GPIO_PuPd=GPIO_PuPd_DOWN; GPIO_Initstrtype.GPIO_Speed=GPIO_Speed_100MHz; GPIO_Init(GPIOA,&GPIO_Initstrtype); } #ifndef __LED_H #define __LED_H #define L_XHG PAin(0) #define LED PFout(9) void LED_Init(void); #endif
STM32通过Uart与ARM通讯,arm_uart接收数据漏码,怎么整?
ARM发送<20字符的数据给stm32,stm32接收到数据后返回<5000字符的数据 ARM收到的数据有<10%的概率出现漏码(少了<20字符)。 arm后台运行7条线程的程序,主要是视频处理+uart通讯+tcp通讯 stm32的uart_tx连接电脑串口数据是正常的,到了arm就漏码了 先贴arm_uart的代码 uart_init ![图片说明](https://img-ask.csdn.net/upload/201811/08/1541647884_643074.png) uart_recv ![图片说明](https://img-ask.csdn.net/upload/201811/08/1541648073_111038.png) 我有个怀疑点,uart通讯用的是115200波特率,arm晶振用的是24MHz,stm32用12MHz 会不会是时钟周期没对上导致漏码?
STM32F407 UART5没反应,波形也不对
#include "usart.h" #include "stm32f4xx.h" #define RS485tX GPIO_SetBits(GPIOE,GPIO_Pin_1);//1 拉高 #define RS485rX GPIO_ResetBits(GPIOE, GPIO_Pin_1);//0 拉低 void uart_init(void) { USART_InitTypeDef USART_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; GPIO_InitTypeDef GPIO_InitStructure; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOE, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_UART5, ENABLE); GPIO_PinAFConfig(GPIOC, GPIO_PinSource12, GPIO_AF_UART5); //UART5_RX GPIO_PinAFConfig(GPIOD, GPIO_PinSource2, GPIO_AF_UART5); //UART5_TX GPIO_PinAFConfig(GPIOE, GPIO_PinSource1, GPIO_AF_UART5); //uart5_DE GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; GPIO_Init(GPIOD, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; GPIO_Init(GPIOE, &GPIO_InitStructure); 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(UART5, &USART_InitStructure); NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); NVIC_InitStructure.NVIC_IRQChannel = UART5_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); USART_Cmd(UART5, ENABLE); USART_ITConfig(UART5, USART_IT_RXNE, ENABLE); } static void delay(unsigned int dl) { unsigned int i,y; for(i = 0; i < 500; i++) { for(y = 0; y < dl; y++); } } void UART5_IRQHandler(void) { uint8_t x,y,z; uint16_t checksum1,checksum2; if(USART_GetITStatus(UART5, USART_IT_RXNE) != RESET) { x=USART_ReceiveData(UART5); USART_SendData(UART5,x); } } void uartsend(int ch) { RS_485tX; delay(100); while(RESET == USART_GetFlagStatus(UART5,USART_FLAG_TXE)); USART_SendData(UART5, (uint8_t) ch); RS485rX; delay(100); } 用的是STM32F407的片子,现在接受和发送数据都没有,这是为什么呢?
arm单片机w7500p如何使用gpio,通过按键来控制gpio,然后通过串口送出去。
按键按下去gpio为1,然后把gpio的数据1通过串口发送出去,然后在串口调试助手中显示1。 一下是我的代码我觉得逻辑没有问题,求大神指点 ![图片说明](https://img-ask.csdn.net/upload/201909/02/1567417444_117961.png) #include <stdio.h> #include "W7500x_uart.h" #include "W7500x_gpio.h" #include "W7500X_crg.h" #include "print_x.h"__ #include "key.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ GPIO_InitTypeDef GPIO_InitDef; UART_InitTypeDef UART_InitStructure; /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ void delay_ms(__IO uint32_t nCount); /** * @brief Main program * @param None * @retval None */ /* GPIO LED(B) Set */ int main() { unsigned char s='1'; uint8_t i; uint16_t num; char str[10]=""; /*System clock configuration*/ SystemInit(); // *(volatile uint32_t *)(0x41001014) = 0x0060100; //clock setting 48MHz /* CLK OUT Set */ PAD_AFConfig(PAD_PA,GPIO_Pin_12, PAD_AF1); // PAD Config - CLKOUT used 3nd Function /* UART0 and UART1 configuration*/ UART_StructInit(&UART_InitStructure); /* Configure UART0 */ UART_Init(UART1,&UART_InitStructure); UART_ITConfig(UART1,UART_IT_FLAG_RXI,ENABLE); S_UART_Init(115200); //S_UART_SetBaud(115200); KEY_Init(); /* Retarget functions for GNU Tools for ARM Embedded Processors*/ GPIO_InitDef.GPIO_Pin = GPIO_Pin_12; // Set to Pin_5 (LED(B)) GPIO_InitDef.GPIO_Mode = GPIO_Mode_OUT; // Set to Mode Output GPIO_Init(GPIOC, &GPIO_InitDef); PAD_AFConfig(PAD_PC,GPIO_Pin_12, PAD_AF1); // PAD Config - LED used 2nd Function // GPIO_SetBits(GPIOC, GPIO_Pin_12); // LED(B) Off while(1) { if(KEY_Csan() == 0) i++; if(i%2 == 0) { GPIO_SetBits(GPIOC, GPIO_Pin_12); num=GPIO_ReadOutputData(GPIOC); UART_SendData(UART1,num); //S_UART_SendData(num); str[0]=num+48; prt_str(str); } else { GPIO_ResetBits(GPIOC, GPIO_Pin_12); num=GPIO_ReadOutputData(GPIOC); UART_SendData(UART1,num); //UART_SendData(num); str[0]=num+48; prt_str(str); } } /* for(;;) { S_UART_SendData(s); printf("UART 1 Test(#1)\r\n"); prt_str("\r\11\r\n"); } // UartPuts(UART1,"UART 1 Test(#1)\r\n"); */ } void delay_ms(__IO uint32_t nCount) { volatile uint32_t delay = nCount * 2500; // approximate loops per ms at 24 MHz, Debug config for(; delay != 0; delay--) __NOP(); } ``` ```
关于stm32UART串口发送数据的问题
我想用stm32单片机的uart串口发送一个十进制的数据(例如adc转换的电压值)到上位机上面。请问怎么把一个十进制的数字发送出去,这个程序要怎么写。我查了一下资料,好像要发送的数据都要求是二进制的。求大佬
小白使用keil编程debug进入了harddefault,搞了半天没解决。求大佬帮下忙。
/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file : main.c * @brief : Main program body ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics. * All rights reserved.</center></h2> * * This software component is licensed by ST under BSD 3-Clause license, * the "License"; You may not use this file except in compliance with the * License. You may obtain a copy of the License at: * opensource.org/licenses/BSD-3-Clause * ****************************************************************************** */ /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "main.h" #include "can.h" #include "usart.h" #include "gpio.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ void CAN_SetTxMsg(void) { hcan.pTxMsg->ExtId=0x1314; //使用的扩展ID hcan.pTxMsg->IDE=CAN_ID_EXT; //扩展模式 hcan.pTxMsg->RTR=CAN_RTR_DATA; //发送的是数据 hcan.pTxMsg->DLC=8; //数据长度为2字节 hcan.pTxMsg->data[0]=0x01; hcan.pTxMsg->data[1]=0x02; hcan.pTxMsg->data[2]=0x03; hcan.pTxMsg->data[3]=0x04; hcan.pTxMsg->data[4]=0x05; hcan.pTxMsg->data[5]=0x06; hcan.pTxMsg->data[6]=0x07; hcan.pTxMsg->data[7]=0x08; } /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN PTD */ /* USER CODE END PTD */ /* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ /* USER CODE END PD */ /* Private macro -------------------------------------------------------------*/ /* USER CODE BEGIN PM */ /* USER CODE END PM */ /* Private variables ---------------------------------------------------------*/ /* USER CODE BEGIN PV */ /* USER CODE END PV */ /* Private function prototypes -----------------------------------------------*/ void SystemClock_Config(void); /* USER CODE BEGIN PFP */ /* USER CODE END PFP */ /* Private user code ---------------------------------------------------------*/ /* USER CODE BEGIN 0 */ /* USER CODE END 0 */ /** * @brief The application entry point. * @retval int */ int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_CAN_Init(); MX_USART1_UART_Init(); /* USER CODE BEGIN 2 */ CAN_SetTxMsg(); HAL_CAN_AddTxMessage(&hcan,hcan.pTxMsg,hcan.pTxMsg->data,(uint32_t*)CAN_TX_MAILBOX0); HAL_CAN_ActivateNotification(&hcan,CAN_IT_RX_FIFO0_MSG_PENDING); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END 3 */ } /** * @brief System Clock Configuration * @retval None */ void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); } /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) { Error_Handler(); } /** Enables the Clock Security System */ HAL_RCC_EnableCSS(); } /* USER CODE BEGIN 4 */ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan) { HAL_CAN_AddTxMessage(hcan,hcan->pTxMsg,hcan->pTxMsg->data,(uint32_t*)CAN_TX_MAILBOX0); HAL_CAN_ActivateNotification(hcan,CAN_IT_RX_FIFO0_MSG_PENDING); } /* USER CODE END 4 */ /** * @brief This function is executed in case of error occurrence. * @retval None */ void Error_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */ /* USER CODE END Error_Handler_Debug */ } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ /* User can add his own implementation to report the file name and line number, tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 这是我的主程序,debug总是在CAN_SetMsg()那里进入了hardfault.下面是定义的一些初始化结构体。 /** ****************************************************************************** * @file stm32f1xx_hal_can.h * @author MCD Application Team * @brief Header file of CAN HAL module. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef STM32F1xx_HAL_CAN_H #define STM32F1xx_HAL_CAN_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32f1xx_hal_def.h" /** @addtogroup STM32F1xx_HAL_Driver * @{ */ #if defined (CAN1) /** @addtogroup CAN * @{ */ /* Exported types ------------------------------------------------------------*/ /** @defgroup CAN_Exported_Types CAN Exported Types * @{ */ /** * @brief HAL State structures definition */ typedef enum { HAL_CAN_STATE_RESET = 0x00U, /*!< CAN not yet initialized or disabled */ HAL_CAN_STATE_READY = 0x01U, /*!< CAN initialized and ready for use */ HAL_CAN_STATE_LISTENING = 0x02U, /*!< CAN receive process is ongoing */ HAL_CAN_STATE_SLEEP_PENDING = 0x03U, /*!< CAN sleep request is pending */ HAL_CAN_STATE_SLEEP_ACTIVE = 0x04U, /*!< CAN sleep mode is active */ HAL_CAN_STATE_ERROR = 0x05U /*!< CAN error state */ } HAL_CAN_StateTypeDef; /** * @brief CAN init structure definition */ typedef struct { uint32_t Prescaler; /*!< Specifies the length of a time quantum. This parameter must be a number between Min_Data = 1 and Max_Data = 1024. */ uint32_t Mode; /*!< Specifies the CAN operating mode. This parameter can be a value of @ref CAN_operating_mode */ uint32_t SyncJumpWidth; /*!< Specifies the maximum number of time quanta the CAN hardware is allowed to lengthen or shorten a bit to perform resynchronization. This parameter can be a value of @ref CAN_synchronisation_jump_width */ uint32_t TimeSeg1; /*!< Specifies the number of time quanta in Bit Segment 1. This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_1 */ uint32_t TimeSeg2; /*!< Specifies the number of time quanta in Bit Segment 2. This parameter can be a value of @ref CAN_time_quantum_in_bit_segment_2 */ FunctionalState TimeTriggeredMode; /*!< Enable or disable the time triggered communication mode. This parameter can be set to ENABLE or DISABLE. */ FunctionalState AutoBusOff; /*!< Enable or disable the automatic bus-off management. This parameter can be set to ENABLE or DISABLE. */ FunctionalState AutoWakeUp; /*!< Enable or disable the automatic wake-up mode. This parameter can be set to ENABLE or DISABLE. */ FunctionalState AutoRetransmission; /*!< Enable or disable the non-automatic retransmission mode. This parameter can be set to ENABLE or DISABLE. */ FunctionalState ReceiveFifoLocked; /*!< Enable or disable the Receive FIFO Locked mode. This parameter can be set to ENABLE or DISABLE. */ FunctionalState TransmitFifoPriority;/*!< Enable or disable the transmit FIFO priority. This parameter can be set to ENABLE or DISABLE. */ } CAN_InitTypeDef; /** * @brief CAN filter configuration structure definition */ typedef struct { uint32_t FilterIdHigh; /*!< Specifies the filter identification number (MSBs for a 32-bit configuration, first one for a 16-bit configuration). This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ uint32_t FilterIdLow; /*!< Specifies the filter identification number (LSBs for a 32-bit configuration, second one for a 16-bit configuration). This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ uint32_t FilterMaskIdHigh; /*!< Specifies the filter mask number or identification number, according to the mode (MSBs for a 32-bit configuration, first one for a 16-bit configuration). This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ uint32_t FilterMaskIdLow; /*!< Specifies the filter mask number or identification number, according to the mode (LSBs for a 32-bit configuration, second one for a 16-bit configuration). This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0xFFFF. */ uint32_t FilterFIFOAssignment; /*!< Specifies the FIFO (0 or 1U) which will be assigned to the filter. This parameter can be a value of @ref CAN_filter_FIFO */ uint32_t FilterBank; /*!< Specifies the filter bank which will be initialized. For single CAN instance(14 dedicated filter banks), this parameter must be a number between Min_Data = 0 and Max_Data = 13. For dual CAN instances(28 filter banks shared), this parameter must be a number between Min_Data = 0 and Max_Data = 27. */ uint32_t FilterMode; /*!< Specifies the filter mode to be initialized. This parameter can be a value of @ref CAN_filter_mode */ uint32_t FilterScale; /*!< Specifies the filter scale. This parameter can be a value of @ref CAN_filter_scale */ uint32_t FilterActivation; /*!< Enable or disable the filter. This parameter can be a value of @ref CAN_filter_activation */ uint32_t SlaveStartFilterBank; /*!< Select the start filter bank for the slave CAN instance. For single CAN instances, this parameter is meaningless. For dual CAN instances, all filter banks with lower index are assigned to master CAN instance, whereas all filter banks with greater index are assigned to slave CAN instance. This parameter must be a number between Min_Data = 0 and Max_Data = 27. */ } CAN_FilterTypeDef; /** * @brief CAN Tx message header structure definition */ typedef struct { uint32_t StdId; /*!< Specifies the standard identifier. This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF. */ uint32_t ExtId; /*!< Specifies the extended identifier. This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF. */ uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted. This parameter can be a value of @ref CAN_identifier_type */ uint32_t RTR; /*!< Specifies the type of frame for the message that will be transmitted. This parameter can be a value of @ref CAN_remote_transmission_request */ uint32_t DLC; /*!< Specifies the length of the frame that will be transmitted. This parameter must be a number between Min_Data = 0 and Max_Data = 8. */ uint8_t data[8]; FunctionalState TransmitGlobalTime; /*!< Specifies whether the timestamp counter value captured on start of frame transmission, is sent in DATA6 and DATA7 replacing pData[6] and pData[7]. @note: Time Triggered Communication Mode must be enabled. @note: DLC must be programmed as 8 bytes, in order these 2 bytes are sent. This parameter can be set to ENABLE or DISABLE. */ } CAN_TxHeaderTypeDef; /** * @brief CAN Rx message header structure definition */ typedef struct { uint32_t StdId; /*!< Specifies the standard identifier. This parameter must be a number between Min_Data = 0 and Max_Data = 0x7FF. */ uint32_t ExtId; /*!< Specifies the extended identifier. This parameter must be a number between Min_Data = 0 and Max_Data = 0x1FFFFFFF. */ uint32_t IDE; /*!< Specifies the type of identifier for the message that will be transmitted. This parameter can be a value of @ref CAN_identifier_type */ uint32_t RTR; /*!< Specifies the type of frame for the message that will be transmitted. This parameter can be a value of @ref CAN_remote_transmission_request */ uint32_t DLC; /*!< Specifies the length of the frame that will be transmitted. This parameter must be a number between Min_Data = 0 and Max_Data = 8. */ uint8_t Data[8]; uint32_t Timestamp; /*!< Specifies the timestamp counter value captured on start of frame reception. @note: Time Triggered Communication Mode must be enabled. This parameter must be a number between Min_Data = 0 and Max_Data = 0xFFFF. */ uint32_t FilterMatchIndex; /*!< Specifies the index of matching acceptance filter element. This parameter must be a number between Min_Data = 0 and Max_Data = 0xFF. */ } CAN_RxHeaderTypeDef; /** * @brief CAN handle Structure definition */ typedef struct __CAN_HandleTypeDef { CAN_TypeDef *Instance; /*!< Register base address */ CAN_InitTypeDef Init; /*!< CAN required parameters */ CAN_TxHeaderTypeDef* pTxMsg; CAN_RxHeaderTypeDef* pRxMsg; HAL_LockTypeDef Lock; __IO HAL_CAN_StateTypeDef State; /*!< CAN communication state */ __IO uint32_t ErrorCode; /*!< CAN Error code. This parameter can be a value of @ref CAN_Error_Code */ } CAN_HandleTypeDef; /** * @} */ /* Exported constants --------------------------------------------------------*/ /** @defgroup CAN_Exported_Constants CAN Exported Constants * @{ */ /** @defgroup CAN_Error_Code CAN Error Code * @{ */ #define HAL_CAN_ERROR_NONE (0x00000000U) /*!< No error */ #define HAL_CAN_ERROR_EWG (0x00000001U) /*!< Protocol Error Warning */ #define HAL_CAN_ERROR_EPV (0x00000002U) /*!< Error Passive */ #define HAL_CAN_ERROR_BOF (0x00000004U) /*!< Bus-off error */ #define HAL_CAN_ERROR_STF (0x00000008U) /*!< Stuff error */ #define HAL_CAN_ERROR_FOR (0x00000010U) /*!< Form error */ #define HAL_CAN_ERROR_ACK (0x00000020U) /*!< Acknowledgment error */ #define HAL_CAN_ERROR_BR (0x00000040U) /*!< Bit recessive error */ #define HAL_CAN_ERROR_BD (0x00000080U) /*!< Bit dominant error */ #define HAL_CAN_ERROR_CRC (0x00000100U) /*!< CRC error */ #define HAL_CAN_ERROR_RX_FOV0 (0x00000200U) /*!< Rx FIFO0 overrun error */ #define HAL_CAN_ERROR_RX_FOV1 (0x00000400U) /*!< Rx FIFO1 overrun error */ #define HAL_CAN_ERROR_TX_ALST0 (0x00000800U) /*!< TxMailbox 0 transmit failure due to arbitration lost */ #define HAL_CAN_ERROR_TX_TERR0 (0x00001000U) /*!< TxMailbox 1 transmit failure due to tranmit error */ #define HAL_CAN_ERROR_TX_ALST1 (0x00002000U) /*!< TxMailbox 0 transmit failure due to arbitration lost */ #define HAL_CAN_ERROR_TX_TERR1 (0x00004000U) /*!< TxMailbox 1 transmit failure due to tranmit error */ #define HAL_CAN_ERROR_TX_ALST2 (0x00008000U) /*!< TxMailbox 0 transmit failure due to arbitration lost */ #define HAL_CAN_ERROR_TX_TERR2 (0x00010000U) /*!< TxMailbox 1 transmit failure due to tranmit error */ #define HAL_CAN_ERROR_TIMEOUT (0x00020000U) /*!< Timeout error */ #define HAL_CAN_ERROR_NOT_INITIALIZED (0x00040000U) /*!< Peripheral not initialized */ #define HAL_CAN_ERROR_NOT_READY (0x00080000U) /*!< Peripheral not ready */ #define HAL_CAN_ERROR_NOT_STARTED (0x00100000U) /*!< Peripheral not started */ #define HAL_CAN_ERROR_PARAM (0x00200000U) /*!< Parameter error */ #define HAL_CAN_ERROR_INTERNAL (0x00800000U) /*!< Internal error */ /** * @} */ /** @defgroup CAN_InitStatus CAN InitStatus * @{ */ #define CAN_INITSTATUS_FAILED (0x00000000U) /*!< CAN initialization failed */ #define CAN_INITSTATUS_SUCCESS (0x00000001U) /*!< CAN initialization OK */ /** * @} */ /** @defgroup CAN_operating_mode CAN Operating Mode * @{ */ #define CAN_MODE_NORMAL (0x00000000U) /*!< Normal mode */ #define CAN_MODE_LOOPBACK ((uint32_t)CAN_BTR_LBKM) /*!< Loopback mode */ #define CAN_MODE_SILENT ((uint32_t)CAN_BTR_SILM) /*!< Silent mode */ #define CAN_MODE_SILENT_LOOPBACK ((uint32_t)(CAN_BTR_LBKM | CAN_BTR_SILM)) /*!< Loopback combined with silent mode */ /** * @} */ /** @defgroup CAN_synchronisation_jump_width CAN Synchronization Jump Width * @{ */ #define CAN_SJW_1TQ (0x00000000U) /*!< 1 time quantum */ #define CAN_SJW_2TQ ((uint32_t)CAN_BTR_SJW_0) /*!< 2 time quantum */ #define CAN_SJW_3TQ ((uint32_t)CAN_BTR_SJW_1) /*!< 3 time quantum */ #define CAN_SJW_4TQ ((uint32_t)CAN_BTR_SJW) /*!< 4 time quantum */ /** * @} */ /** @defgroup CAN_time_quantum_in_bit_segment_1 CAN Time Quantum in Bit Segment 1 * @{ */ #define CAN_BS1_1TQ (0x00000000U) /*!< 1 time quantum */ #define CAN_BS1_2TQ ((uint32_t)CAN_BTR_TS1_0) /*!< 2 time quantum */ #define CAN_BS1_3TQ ((uint32_t)CAN_BTR_TS1_1) /*!< 3 time quantum */ #define CAN_BS1_4TQ ((uint32_t)(CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 4 time quantum */ #define CAN_BS1_5TQ ((uint32_t)CAN_BTR_TS1_2) /*!< 5 time quantum */ #define CAN_BS1_6TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 6 time quantum */ #define CAN_BS1_7TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 7 time quantum */ #define CAN_BS1_8TQ ((uint32_t)(CAN_BTR_TS1_2 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 8 time quantum */ #define CAN_BS1_9TQ ((uint32_t)CAN_BTR_TS1_3) /*!< 9 time quantum */ #define CAN_BS1_10TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_0)) /*!< 10 time quantum */ #define CAN_BS1_11TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1)) /*!< 11 time quantum */ #define CAN_BS1_12TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_1 | CAN_BTR_TS1_0)) /*!< 12 time quantum */ #define CAN_BS1_13TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2)) /*!< 13 time quantum */ #define CAN_BS1_14TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_0)) /*!< 14 time quantum */ #define CAN_BS1_15TQ ((uint32_t)(CAN_BTR_TS1_3 | CAN_BTR_TS1_2 | CAN_BTR_TS1_1)) /*!< 15 time quantum */ #define CAN_BS1_16TQ ((uint32_t)CAN_BTR_TS1) /*!< 16 time quantum */ /** * @} */ /** @defgroup CAN_time_quantum_in_bit_segment_2 CAN Time Quantum in Bit Segment 2 * @{ */ #define CAN_BS2_1TQ (0x00000000U) /*!< 1 time quantum */ #define CAN_BS2_2TQ ((uint32_t)CAN_BTR_TS2_0) /*!< 2 time quantum */ #define CAN_BS2_3TQ ((uint32_t)CAN_BTR_TS2_1) /*!< 3 time quantum */ #define CAN_BS2_4TQ ((uint32_t)(CAN_BTR_TS2_1 | CAN_BTR_TS2_0)) /*!< 4 time quantum */ #define CAN_BS2_5TQ ((uint32_t)CAN_BTR_TS2_2) /*!< 5 time quantum */ #define CAN_BS2_6TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_0)) /*!< 6 time quantum */ #define CAN_BS2_7TQ ((uint32_t)(CAN_BTR_TS2_2 | CAN_BTR_TS2_1)) /*!< 7 time quantum */ #define CAN_BS2_8TQ ((uint32_t)CAN_BTR_TS2) /*!< 8 time quantum */ /** * @} */ /** @defgroup CAN_filter_mode CAN Filter Mode * @{ */ #define CAN_FILTERMODE_IDMASK (0x00000000U) /*!< Identifier mask mode */ #define CAN_FILTERMODE_IDLIST (0x00000001U) /*!< Identifier list mode */ /** * @} */ /** @defgroup CAN_filter_scale CAN Filter Scale * @{ */ #define CAN_FILTERSCALE_16BIT (0x00000000U) /*!< Two 16-bit filters */ #define CAN_FILTERSCALE_32BIT (0x00000001U) /*!< One 32-bit filter */ /** * @} */ /** @defgroup CAN_filter_activation CAN Filter Activation * @{ */ #define CAN_FILTER_DISABLE (0x00000000U) /*!< Disable filter */ #define CAN_FILTER_ENABLE (0x00000001U) /*!< Enable filter */ /** * @} */ /** @defgroup CAN_filter_FIFO CAN Filter FIFO * @{ */ #define CAN_FILTER_FIFO0 (0x00000000U) /*!< Filter FIFO 0 assignment for filter x */ #define CAN_FILTER_FIFO1 (0x00000001U) /*!< Filter FIFO 1 assignment for filter x */ /** * @} */ /** @defgroup CAN_identifier_type CAN Identifier Type * @{ */ #define CAN_ID_STD ((uint32_t)0x00000000) /*!< Standard Id */ #define CAN_ID_EXT ((uint32_t)0x00000004) /*!< Extended Id */ /** * @} */ /** @defgroup CAN_remote_transmission_request CAN Remote Transmission Request * @{ */ #define CAN_RTR_DATA ((uint32_t)0x00000000) /*!< Data frame */ #define CAN_RTR_REMOTE ((uint32_t)0x00000002) /*!< Remote frame */ /** * @} */ /** @defgroup CAN_receive_FIFO_number CAN Receive FIFO Number * @{ */ #define CAN_RX_FIFO0 (0x00000000U) /*!< CAN receive FIFO 0 */ #define CAN_RX_FIFO1 (0x00000001U) /*!< CAN receive FIFO 1 */ /** * @} */ /** @defgroup CAN_Tx_Mailboxes CAN Tx Mailboxes * @{ */ #define CAN_TX_MAILBOX0 (0x00000001U) /*!< Tx Mailbox 0 */ #define CAN_TX_MAILBOX1 (0x00000002U) /*!< Tx Mailbox 1 */ #define CAN_TX_MAILBOX2 (0x00000004U) /*!< Tx Mailbox 2 */ /** * @} */ /** @defgroup CAN_flags CAN Flags * @{ */ /* Transmit Flags */ #define CAN_FLAG_RQCP0 (0x00000500U) /*!< Request complete MailBox 0 flag */ #define CAN_FLAG_TXOK0 (0x00000501U) /*!< Transmission OK MailBox 0 flag */ #define CAN_FLAG_ALST0 (0x00000502U) /*!< Arbitration Lost MailBox 0 flag */ #define CAN_FLAG_TERR0 (0x00000503U) /*!< Transmission error MailBox 0 flag */ #define CAN_FLAG_RQCP1 (0x00000508U) /*!< Request complete MailBox1 flag */ #define CAN_FLAG_TXOK1 (0x00000509U) /*!< Transmission OK MailBox 1 flag */ #define CAN_FLAG_ALST1 (0x0000050AU) /*!< Arbitration Lost MailBox 1 flag */ #define CAN_FLAG_TERR1 (0x0000050BU) /*!< Transmission error MailBox 1 flag */ #define CAN_FLAG_RQCP2 (0x00000510U) /*!< Request complete MailBox2 flag */ #define CAN_FLAG_TXOK2 (0x00000511U) /*!< Transmission OK MailBox 2 flag */ #define CAN_FLAG_ALST2 (0x00000512U) /*!< Arbitration Lost MailBox 2 flag */ #define CAN_FLAG_TERR2 (0x00000513U) /*!< Transmission error MailBox 2 flag */ #define CAN_FLAG_TME0 (0x0000051AU) /*!< Transmit mailbox 0 empty flag */ #define CAN_FLAG_TME1 (0x0000051BU) /*!< Transmit mailbox 1 empty flag */ #define CAN_FLAG_TME2 (0x0000051CU) /*!< Transmit mailbox 2 empty flag */ #define CAN_FLAG_LOW0 (0x0000051DU) /*!< Lowest priority mailbox 0 flag */ #define CAN_FLAG_LOW1 (0x0000051EU) /*!< Lowest priority mailbox 1 flag */ #define CAN_FLAG_LOW2 (0x0000051FU) /*!< Lowest priority mailbox 2 flag */ /* Receive Flags */ #define CAN_FLAG_FF0 (0x00000203U) /*!< RX FIFO 0 Full flag */ #define CAN_FLAG_FOV0 (0x00000204U) /*!< RX FIFO 0 Overrun flag */ #define CAN_FLAG_FF1 (0x00000403U) /*!< RX FIFO 1 Full flag */ #define CAN_FLAG_FOV1 (0x00000404U) /*!< RX FIFO 1 Overrun flag */ /* Operating Mode Flags */ #define CAN_FLAG_INAK (0x00000100U) /*!< Initialization acknowledge flag */ #define CAN_FLAG_SLAK (0x00000101U) /*!< Sleep acknowledge flag */ #define CAN_FLAG_ERRI (0x00000102U) /*!< Error flag */ #define CAN_FLAG_WKU (0x00000103U) /*!< Wake up interrupt flag */ #define CAN_FLAG_SLAKI (0x00000104U) /*!< Sleep acknowledge interrupt flag */ /* Error Flags */ #define CAN_FLAG_EWG (0x00000300U) /*!< Error warning flag */ #define CAN_FLAG_EPV (0x00000301U) /*!< Error passive flag */ #define CAN_FLAG_BOF (0x00000302U) /*!< Bus-Off flag */ /** * @} */ /** @defgroup CAN_Interrupts CAN Interrupts * @{ */ /* Transmit Interrupt */ #define CAN_IT_TX_MAILBOX_EMPTY ((uint32_t)CAN_IER_TMEIE) /*!< Transmit mailbox empty interrupt */ /* Receive Interrupts */ #define CAN_IT_RX_FIFO0_MSG_PENDING ((uint32_t)CAN_IER_FMPIE0) /*!< FIFO 0 message pending interrupt */ #define CAN_IT_RX_FIFO0_FULL ((uint32_t)CAN_IER_FFIE0) /*!< FIFO 0 full interrupt */ #define CAN_IT_RX_FIFO0_OVERRUN ((uint32_t)CAN_IER_FOVIE0) /*!< FIFO 0 overrun interrupt */ #define CAN_IT_RX_FIFO1_MSG_PENDING ((uint32_t)CAN_IER_FMPIE1) /*!< FIFO 1 message pending interrupt */ #define CAN_IT_RX_FIFO1_FULL ((uint32_t)CAN_IER_FFIE1) /*!< FIFO 1 full interrupt */ #define CAN_IT_RX_FIFO1_OVERRUN ((uint32_t)CAN_IER_FOVIE1) /*!< FIFO 1 overrun interrupt */ /* Operating Mode Interrupts */ #define CAN_IT_WAKEUP ((uint32_t)CAN_IER_WKUIE) /*!< Wake-up interrupt */ #define CAN_IT_SLEEP_ACK ((uint32_t)CAN_IER_SLKIE) /*!< Sleep acknowledge interrupt */ /* Error Interrupts */ #define CAN_IT_ERROR_WARNING ((uint32_t)CAN_IER_EWGIE) /*!< Error warning interrupt */ #define CAN_IT_ERROR_PASSIVE ((uint32_t)CAN_IER_EPVIE) /*!< Error passive interrupt */ #define CAN_IT_BUSOFF ((uint32_t)CAN_IER_BOFIE) /*!< Bus-off interrupt */ #define CAN_IT_LAST_ERROR_CODE ((uint32_t)CAN_IER_LECIE) /*!< Last error code interrupt */ #define CAN_IT_ERROR ((uint32_t)CAN_IER_ERRIE) /*!< Error Interrupt */ /** * @} */ /** * @} */ /* Exported macros -----------------------------------------------------------*/ /** @defgroup CAN_Exported_Macros CAN Exported Macros * @{ */ /** @brief Reset CAN handle state * @param __HANDLE__ CAN handle. * @retval None */ #define __HAL_CAN_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CAN_STATE_RESET) /** * @brief Enable the specified CAN interrupts. * @param __HANDLE__ CAN handle. * @param __INTERRUPT__ CAN Interrupt sources to enable. * This parameter can be any combination of @arg CAN_Interrupts * @retval None */ #define __HAL_CAN_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) |= (__INTERRUPT__)) /** * @brief Disable the specified CAN interrupts. * @param __HANDLE__ CAN handle. * @param __INTERRUPT__ CAN Interrupt sources to disable. * This parameter can be any combination of @arg CAN_Interrupts * @retval None */ #define __HAL_CAN_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) &= ~(__INTERRUPT__)) /** @brief Check if the specified CAN interrupt source is enabled or disabled. * @param __HANDLE__ specifies the CAN Handle. * @param __INTERRUPT__ specifies the CAN interrupt source to check. * This parameter can be a value of @arg CAN_Interrupts * @retval The state of __IT__ (TRUE or FALSE). */ #define __HAL_CAN_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->IER) & (__INTERRUPT__)) /** @brief Check whether the specified CAN flag is set or not. * @param __HANDLE__ specifies the CAN Handle. * @param __FLAG__ specifies the flag to check. * This parameter can be one of @arg CAN_flags * @retval The state of __FLAG__ (TRUE or FALSE). */ #define __HAL_CAN_GET_FLAG(__HANDLE__, __FLAG__) \ ((((__FLAG__) >> 8U) == 5U)? ((((__HANDLE__)->Instance->TSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 2U)? ((((__HANDLE__)->Instance->RF0R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 4U)? ((((__HANDLE__)->Instance->RF1R) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 1U)? ((((__HANDLE__)->Instance->MSR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 3U)? ((((__HANDLE__)->Instance->ESR) & (1U << ((__FLAG__) & CAN_FLAG_MASK))) == (1U << ((__FLAG__) & CAN_FLAG_MASK))): 0U) /** @brief Clear the specified CAN pending flag. * @param __HANDLE__ specifies the CAN Handle. * @param __FLAG__ specifies the flag to check. * This parameter can be one of the following values: * @arg CAN_FLAG_RQCP0: Request complete MailBox 0 Flag * @arg CAN_FLAG_TXOK0: Transmission OK MailBox 0 Flag * @arg CAN_FLAG_ALST0: Arbitration Lost MailBox 0 Flag * @arg CAN_FLAG_TERR0: Transmission error MailBox 0 Flag * @arg CAN_FLAG_RQCP1: Request complete MailBox 1 Flag * @arg CAN_FLAG_TXOK1: Transmission OK MailBox 1 Flag * @arg CAN_FLAG_ALST1: Arbitration Lost MailBox 1 Flag * @arg CAN_FLAG_TERR1: Transmission error MailBox 1 Flag * @arg CAN_FLAG_RQCP2: Request complete MailBox 2 Flag * @arg CAN_FLAG_TXOK2: Transmission OK MailBox 2 Flag * @arg CAN_FLAG_ALST2: Arbitration Lost MailBox 2 Flag * @arg CAN_FLAG_TERR2: Transmission error MailBox 2 Flag * @arg CAN_FLAG_FF0: RX FIFO 0 Full Flag * @arg CAN_FLAG_FOV0: RX FIFO 0 Overrun Flag * @arg CAN_FLAG_FF1: RX FIFO 1 Full Flag * @arg CAN_FLAG_FOV1: RX FIFO 1 Overrun Flag * @arg CAN_FLAG_WKUI: Wake up Interrupt Flag * @arg CAN_FLAG_SLAKI: Sleep acknowledge Interrupt Flag * @retval None */ #define __HAL_CAN_CLEAR_FLAG(__HANDLE__, __FLAG__) \ ((((__FLAG__) >> 8U) == 5U)? (((__HANDLE__)->Instance->TSR) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 2U)? (((__HANDLE__)->Instance->RF0R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 4U)? (((__HANDLE__)->Instance->RF1R) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): \ (((__FLAG__) >> 8U) == 1U)? (((__HANDLE__)->Instance->MSR) = (1U << ((__FLAG__) & CAN_FLAG_MASK))): 0U) /** * @} */ /* Exported functions --------------------------------------------------------*/ /** @addtogroup CAN_Exported_Functions CAN Exported Functions * @{ */ /** @addtogroup CAN_Exported_Functions_Group1 Initialization and de-initialization functions * @brief Initialization and Configuration functions * @{ */ /* Initialization and de-initialization functions *****************************/ HAL_StatusTypeDef HAL_CAN_Init(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_DeInit(CAN_HandleTypeDef *hcan); void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan); void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan); /** * @} */ /** @addtogroup CAN_Exported_Functions_Group2 Configuration functions * @brief Configuration functions * @{ */ /* Configuration functions ****************************************************/ HAL_StatusTypeDef HAL_CAN_ConfigFilter(CAN_HandleTypeDef *hcan, CAN_FilterTypeDef *sFilterConfig); /** * @} */ /** @addtogroup CAN_Exported_Functions_Group3 Control functions * @brief Control functions * @{ */ /* Control functions **********************************************************/ HAL_StatusTypeDef HAL_CAN_Start(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_Stop(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_RequestSleep(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_WakeUp(CAN_HandleTypeDef *hcan); uint32_t HAL_CAN_IsSleepActive(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_AddTxMessage(CAN_HandleTypeDef *hcan, CAN_TxHeaderTypeDef *pHeader, uint8_t aData[], uint32_t *pTxMailbox); HAL_StatusTypeDef HAL_CAN_AbortTxRequest(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes); uint32_t HAL_CAN_GetTxMailboxesFreeLevel(CAN_HandleTypeDef *hcan); uint32_t HAL_CAN_IsTxMessagePending(CAN_HandleTypeDef *hcan, uint32_t TxMailboxes); uint32_t HAL_CAN_GetTxTimestamp(CAN_HandleTypeDef *hcan, uint32_t TxMailbox); HAL_StatusTypeDef HAL_CAN_GetRxMessage(CAN_HandleTypeDef *hcan, uint32_t RxFifo, CAN_RxHeaderTypeDef *pHeader, uint8_t aData[]); uint32_t HAL_CAN_GetRxFifoFillLevel(CAN_HandleTypeDef *hcan, uint32_t RxFifo); /** * @} */ /** @addtogroup CAN_Exported_Functions_Group4 Interrupts management * @brief Interrupts management * @{ */ /* Interrupts management ******************************************************/ HAL_StatusTypeDef HAL_CAN_ActivateNotification(CAN_HandleTypeDef *hcan, uint32_t ActiveITs); HAL_StatusTypeDef HAL_CAN_DeactivateNotification(CAN_HandleTypeDef *hcan, uint32_t InactiveITs); void HAL_CAN_IRQHandler(CAN_HandleTypeDef *hcan); /** * @} */ /** @addtogroup CAN_Exported_Functions_Group5 Callback functions * @brief Callback functions * @{ */ /* Callbacks functions ********************************************************/ void HAL_CAN_TxMailbox0CompleteCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_TxMailbox1CompleteCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_TxMailbox2CompleteCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_TxMailbox0AbortCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_TxMailbox1AbortCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_TxMailbox2AbortCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_RxFifo0FullCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_RxFifo1FullCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_SleepCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_WakeUpFromRxMsgCallback(CAN_HandleTypeDef *hcan); void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan); /** * @} */ /** @addtogroup CAN_Exported_Functions_Group6 Peripheral State and Error functions * @brief CAN Peripheral State functions * @{ */ /* Peripheral State and Error functions ***************************************/ HAL_CAN_StateTypeDef HAL_CAN_GetState(CAN_HandleTypeDef *hcan); uint32_t HAL_CAN_GetError(CAN_HandleTypeDef *hcan); HAL_StatusTypeDef HAL_CAN_ResetError(CAN_HandleTypeDef *hcan); /** * @} */ /** * @} */ /* Private types -------------------------------------------------------------*/ /** @defgroup CAN_Private_Types CAN Private Types * @{ */ /** * @} */ /* Private variables ---------------------------------------------------------*/ /** @defgroup CAN_Private_Variables CAN Private Variables * @{ */ /** * @} */ /* Private constants ---------------------------------------------------------*/ /** @defgroup CAN_Private_Constants CAN Private Constants * @{ */ #define CAN_FLAG_MASK (0x000000FFU) /** * @} */ /* Private Macros -----------------------------------------------------------*/ /** @defgroup CAN_Private_Macros CAN Private Macros * @{ */ #define IS_CAN_MODE(MODE) (((MODE) == CAN_MODE_NORMAL) || \ ((MODE) == CAN_MODE_LOOPBACK)|| \ ((MODE) == CAN_MODE_SILENT) || \ ((MODE) == CAN_MODE_SILENT_LOOPBACK)) #define IS_CAN_SJW(SJW) (((SJW) == CAN_SJW_1TQ) || ((SJW) == CAN_SJW_2TQ) || \ ((SJW) == CAN_SJW_3TQ) || ((SJW) == CAN_SJW_4TQ)) #define IS_CAN_BS1(BS1) (((BS1) == CAN_BS1_1TQ) || ((BS1) == CAN_BS1_2TQ) || \ ((BS1) == CAN_BS1_3TQ) || ((BS1) == CAN_BS1_4TQ) || \ ((BS1) == CAN_BS1_5TQ) || ((BS1) == CAN_BS1_6TQ) || \ ((BS1) == CAN_BS1_7TQ) || ((BS1) == CAN_BS1_8TQ) || \ ((BS1) == CAN_BS1_9TQ) || ((BS1) == CAN_BS1_10TQ)|| \ ((BS1) == CAN_BS1_11TQ)|| ((BS1) == CAN_BS1_12TQ)|| \ ((BS1) == CAN_BS1_13TQ)|| ((BS1) == CAN_BS1_14TQ)|| \ ((BS1) == CAN_BS1_15TQ)|| ((BS1) == CAN_BS1_16TQ)) #define IS_CAN_BS2(BS2) (((BS2) == CAN_BS2_1TQ) || ((BS2) == CAN_BS2_2TQ) || \ ((BS2) == CAN_BS2_3TQ) || ((BS2) == CAN_BS2_4TQ) || \ ((BS2) == CAN_BS2_5TQ) || ((BS2) == CAN_BS2_6TQ) || \ ((BS2) == CAN_BS2_7TQ) || ((BS2) == CAN_BS2_8TQ)) #define IS_CAN_PRESCALER(PRESCALER) (((PRESCALER) >= 1U) && ((PRESCALER) <= 1024U)) #define IS_CAN_FILTER_ID_HALFWORD(HALFWORD) ((HALFWORD) <= 0xFFFFU) #if defined(CAN2) #define IS_CAN_FILTER_BANK_DUAL(BANK) ((BANK) <= 27U) #endif #define IS_CAN_FILTER_BANK_SINGLE(BANK) ((BANK) <= 13U) #define IS_CAN_FILTER_MODE(MODE) (((MODE) == CAN_FILTERMODE_IDMASK) || \ ((MODE) == CAN_FILTERMODE_IDLIST)) #define IS_CAN_FILTER_SCALE(SCALE) (((SCALE) == CAN_FILTERSCALE_16BIT) || \ ((SCALE) == CAN_FILTERSCALE_32BIT)) #define IS_CAN_FILTER_ACTIVATION(ACTIVATION) (((ACTIVATION) == CAN_FILTER_DISABLE) || \ ((ACTIVATION) == CAN_FILTER_ENABLE)) #define IS_CAN_FILTER_FIFO(FIFO) (((FIFO) == CAN_FILTER_FIFO0) || \ ((FIFO) == CAN_FILTER_FIFO1)) #define IS_CAN_TX_MAILBOX(TRANSMITMAILBOX) (((TRANSMITMAILBOX) == CAN_TX_MAILBOX0 ) || \ ((TRANSMITMAILBOX) == CAN_TX_MAILBOX1 ) || \ ((TRANSMITMAILBOX) == CAN_TX_MAILBOX2 )) #define IS_CAN_TX_MAILBOX_LIST(TRANSMITMAILBOX) ((TRANSMITMAILBOX) <= (CAN_TX_MAILBOX0 | CAN_TX_MAILBOX1 | CAN_TX_MAILBOX2)) #define IS_CAN_STDID(STDID) ((STDID) <= 0x7FFU) #define IS_CAN_EXTID(EXTID) ((EXTID) <= 0x1FFFFFFFU) #define IS_CAN_DLC(DLC) ((DLC) <= 8U) #define IS_CAN_IDTYPE(IDTYPE) (((IDTYPE) == CAN_ID_STD) || \ ((IDTYPE) == CAN_ID_EXT)) #define IS_CAN_RTR(RTR) (((RTR) == CAN_RTR_DATA) || ((RTR) == CAN_RTR_REMOTE)) #define IS_CAN_RX_FIFO(FIFO) (((FIFO) == CAN_RX_FIFO0) || ((FIFO) == CAN_RX_FIFO1)) #define IS_CAN_IT(IT) ((IT) <= (CAN_IT_TX_MAILBOX_EMPTY | CAN_IT_RX_FIFO0_MSG_PENDING | \ CAN_IT_RX_FIFO0_FULL | CAN_IT_RX_FIFO0_OVERRUN | \ CAN_IT_RX_FIFO1_MSG_PENDING | CAN_IT_RX_FIFO1_FULL | \ CAN_IT_RX_FIFO1_OVERRUN | CAN_IT_WAKEUP | \ CAN_IT_SLEEP_ACK | CAN_IT_ERROR_WARNING | \ CAN_IT_ERROR_PASSIVE | CAN_IT_BUSOFF | \ CAN_IT_LAST_ERROR_CODE | CAN_IT_ERROR)) /** * @} */ /* End of private macros -----------------------------------------------------*/ /** * @} */ #endif /* CAN1 */ /** * @} */ #ifdef __cplusplus } #endif #endif /* STM32F1xx_HAL_CAN_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 求大佬指点哪里错了。。
关于ESP32外接串口通讯测试问题,求大神指点
ESP新手一枚,写了一段串口代码如下: ``` const int uart_num = UART_NUM_0; void uart_init(void) { //串口配置结构体 uart_config_t uart_config = { .baud_rate = 115200, .data_bits = UART_DATA_8_BITS, .parity = UART_PARITY_DISABLE, .stop_bits = UART_STOP_BITS_1, .flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS, .rx_flow_ctrl_thresh = 122, }; printf("!!!!!!!!!!!!!!\n"); ESP_ERROR_CHECK(uart_param_config(uart_num, &uart_config)); //设置串口 //IO映射-> T:IO16 R:IO17 printf("@@@@@@@@@@@@@@@@\n"); ESP_ERROR_CHECK(uart_set_pin(uart_num, TXD_PIN, RXD_PIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE)); //注册串口服务即使能+设置缓存区大小 printf("###############\n"); ESP_ERROR_CHECK(uart_driver_install(uart_num, RX_BUF_SIZE * 2, TX_BUF_SIZE * 2, 0, NULL, 0)); } void uart_rx_task() { static const char *RX_TASK_TAG = "RX_TASK"; uint8_t* data = (uint8_t*) malloc(RX_BUF_SIZE+1);//分配内存,用于串口接收 while (1) { //获取串口1接收的数据 const int rxBytes = uart_read_bytes(uart_num, data, RX_BUF_SIZE, 10 / portTICK_RATE_MS); if (rxBytes > 0) { data[rxBytes] = 0;//在串口接收的数据增加结束符 ESP_LOGI(RX_TASK_TAG, "Read %d bytes: '%s'", rxBytes, data); ESP_LOG_BUFFER_HEXDUMP(RX_TASK_TAG, data, rxBytes, ESP_LOG_INFO); //将接收到的数据发出去 uart_write_bytes(uart_num, (char *)data, rxBytes); } } free(data);//释放申请的内存 } ``` 烧写后mointor打印如下:![图片说明](https://img-ask.csdn.net/upload/201908/08/1565253839_295399.png)monitor中没有错误信息,我认为串口配置正确,然后想测试串口收发数据是否正常,根据开发文档提示,将RX,TX,GND与另外一个UAB转串口进行链接,连线图: ![使能UART,将RXD,TXD与RXD0,TXD0跳帽链接](https://img-ask.csdn.net/upload/201908/08/1565255304_778741.jpg) 重新给开发板上电,monitor打印如下![图片说明](https://img-ask.csdn.net/upload/201908/08/1565254687_420703.png),各位大神帮我看看,问题出在哪里了,在这里谢过了
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
阿里面试官问我:如何设计秒杀系统?我的回答让他比起大拇指
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图和个人联系方式,欢迎Star和指教 前言 Redis在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在Redis的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸,打败了...
C语言魔塔游戏
很早就很想写这个,今天终于写完了。 游戏截图: 编译环境: VS2017 游戏需要一些图片,如果有想要的或者对游戏有什么看法的可以加我的QQ 2985486630 讨论,如果暂时没有回应,可以在博客下方留言,到时候我会看到。 下面我来介绍一下游戏的主要功能和实现方式 首先是玩家的定义,使用结构体,这个名字是可以自己改变的 struct gamerole { char n...
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
Android性能优化(4):UI渲染机制以及优化
文章目录1. 渲染机制分析1.1 渲染机制1.2 卡顿现象1.3 内存抖动2. 渲染优化方式2.1 过度绘制优化2.1.1 Show GPU overdraw2.1.2 Profile GPU Rendering2.2 卡顿优化2.2.1 SysTrace2.2.2 TraceView 在从Android 6.0源码的角度剖析View的绘制原理一文中,我们了解到View的绘制流程有三个步骤,即m...
微服务中的Kafka与Micronaut
今天,我们将通过Apache Kafka主题构建一些彼此异步通信的微服务。我们使用Micronaut框架,它为与Kafka集成提供专门的库。让我们简要介绍一下示例系统的体系结构。我们有四个微型服务:订单服务,行程服务,司机服务和乘客服务。这些应用程序的实现非常简单。它们都有内存存储,并连接到同一个Kafka实例。 我们系统的主要目标是为客户安排行程。订单服务应用程序还充当网关。它接收来自客户的请求...
致 Python 初学者们!
作者| 许向武 责编 | 屠敏 出品 | CSDN 博客 前言 在 Python 进阶的过程中,相信很多同学应该大致上学习了很多 Python 的基础知识,也正在努力成长。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 Python 这门编程语言,从2009年开始单一使用 Python 应对所有的开发工作,直至今...
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
字节跳动面试官这样问消息队列:分布式事务、重复消费、顺序消费,我整理了一下
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip installselenium -ihttps://pypi.tuna.tsinghua.edu.cn/simple/ ...
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca...
SpringBoot2.x系列教程(三十六)SpringBoot之Tomcat配置
Spring Boot默认内嵌的Tomcat为Servlet容器,关于Tomcat的所有属性都在ServerProperties配置类中。同时,也可以实现一些接口来自定义内嵌Servlet容器和内嵌Tomcat等的配置。 关于此配置,网络上有大量的资料,但都是基于SpringBoot1.5.x版本,并不适合当前最新版本。本文将带大家了解一下最新版本的使用。 ServerProperties的部分源...
Python绘图,圣诞树,花,爱心 | Turtle篇
每周每日,分享Python实战代码,入门资料,进阶资料,基础语法,爬虫,数据分析,web网站,机器学习,深度学习等等。 公众号回复【进群】沟通交流吧,QQ扫码进群学习吧 微信群 QQ群 1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle()...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
破14亿,Python分析我国存在哪些人口危机!
一、背景 二、爬取数据 三、数据分析 1、总人口 2、男女人口比例 3、人口城镇化 4、人口增长率 5、人口老化(抚养比) 6、各省人口 7、世界人口 四、遇到的问题 遇到的问题 1、数据分页,需要获取从1949-2018年数据,观察到有近20年参数:LAST20,由此推测获取近70年的参数可设置为:LAST70 2、2019年数据没有放上去,可以手动添加上去 3、将数据进行 行列转换 4、列名...
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o...
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ...... ...
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。 再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。 下文是原回答,希望能对你能有所启发。 如果我说,这个世界上人真的分三六九等,...
2020年全新Java学习路线图,含配套视频,学完即为中级Java程序员!!
新的一年来临,突如其来的疫情打破了平静的生活! 在家的你是否很无聊,如果无聊就来学习吧! 世上只有一种投资只赚不赔,那就是学习!!! 传智播客于2020年升级了Java学习线路图,硬核升级,免费放送! 学完你就是中级程序员,能更快一步找到工作! 一、Java基础 JavaSE基础是Java中级程序员的起点,是帮助你从小白到懂得编程的必经之路。 在Java基础板块中有6个子模块的学...
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合...
爬取薅羊毛网站百度云资源
这是疫情期间无聊做的爬虫, 去获取暂时用不上的教程 import threading import time import pandas as pd import requests import re from threading import Thread, Lock # import urllib.request as request # req=urllib.request.Requ...
如何优雅地打印一个Java对象?
你好呀,我是沉默王二,一个和黄家驹一样身高,和刘德华一样颜值的程序员。虽然已经写了十多年的 Java 代码,但仍然觉得自己是个菜鸟(请允许我惭愧一下)。 在一个月黑风高的夜晚,我思前想后,觉得再也不能这么蹉跎下去了。于是痛下决心,准备通过输出的方式倒逼输入,以此来修炼自己的内功,从而进阶成为一名真正意义上的大神。与此同时,希望这些文章能够帮助到更多的读者,让大家在学习的路上不再寂寞、空虚和冷。 ...
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名...
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计...
HTML5适合的情人节礼物有纪念日期功能
前言 利用HTML5,css,js实现爱心树 以及 纪念日期的功能 网页有播放音乐功能 以及打字倾诉感情的画面,非常适合情人节送给女朋友 具体的HTML代码 具体只要修改代码里面的男某某和女某某 文字段也可自行修改,还有代码下半部分的JS代码需要修改一下起始日期 注意月份为0~11月 也就是月份需要减一。 当然只有一部分HTML和JS代码不够运行的,文章最下面还附加了完整代码的下载地址 &lt;!...
Python新型冠状病毒疫情数据自动爬取+统计+发送报告+数据屏幕(三)发送篇
今天介绍的项目是使用 Itchat 发送统计报告 项目功能设计: 定时爬取疫情数据存入Mysql 进行数据分析制作疫情报告 使用itchat给亲人朋友发送分析报告 基于Django做数据屏幕 使用Tableau做数据分析 来看看最终效果 目前已经完成,预计2月12日前更新 使用 itchat 发送数据统计报告 itchat 是一个基于 web微信的一个框架,但微信官方并不允许使用这...
相关热词 c# 为空 判断 委托 c#记事本颜色 c# 系统默认声音 js中调用c#方法参数 c#引入dll文件报错 c#根据名称实例化 c#从邮件服务器获取邮件 c# 保存文件夹 c#代码打包引用 c# 压缩效率
立即提问