Ср мар 11, 2020 17:36:20
void Jump2Boot(){
void (*SysMemBootJump)(void);
volatile uint32_t addr = 0x1FFFC800;
for(int i = 0; i < 7200000; ++i) nop();
USB->BCDR &= ~USB_BCDR_DPPU; // deactivate pullup
for(int i = 0; i < 7200000; ++i) nop();
//sysreset();
// reset systick
SysTick->CTRL = 0;
// disable all interrupts
__disable_irq();
NVIC->ICER[0] = 0xffffffff;
NVIC->ICPR[0] = 0xffffffff;
__DSB();__ISB();
// Enable the SYSCFG peripheral.
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
// remap memory to 0 (only for STM32F0)
SYSCFG->CFGR1 = 0x01;
__DSB();__ISB();
SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));
// set main stack pointer
__set_MSP(*((uint32_t *)addr));
SysMemBootJump();
}
[2008912.252304] usb 1-7: USB disconnect, device number 17
[2008912.252551] pl2303 ttyUSB0: error sending break = -19
[2008912.252767] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
[2008912.252789] pl2303 1-7:1.0: device disconnected
[2008913.702173] usb 1-7: new full-speed USB device number 18 using xhci_hcd
[2008913.816199] usb 1-7: device descriptor read/64, error -71
[2008914.033219] usb 1-7: device descriptor read/64, error -71
[2008914.249225] usb 1-7: new full-speed USB device number 19 using xhci_hcd
[2008914.363118] usb 1-7: device descriptor read/64, error -71
[2008914.585212] usb 1-7: device descriptor read/64, error -71
[2008914.687252] usb usb1-port7: attempt power cycle
[2008915.315111] usb 1-7: new full-speed USB device number 20 using xhci_hcd
[2008915.315270] usb 1-7: Device not responding to setup address.
[2008915.519278] usb 1-7: Device not responding to setup address.
Ср мар 11, 2020 17:40:39
RCC->AHBRSTR = RCC_AHBRSTR_TSCRST | RCC_AHBRSTR_GPIOFRST | RCC_AHBRSTR_GPIOERST | RCC_AHBRSTR_GPIODRST |
RCC_AHBRSTR_GPIOCRST | RCC_AHBRSTR_GPIOBRST | RCC_AHBRSTR_GPIOARST;
RCC->APB1RSTR = RCC_APB1RSTR_CECRST | RCC_APB1RSTR_DACRST | RCC_APB1RSTR_PWRRST | RCC_APB1RSTR_CRSRST |
RCC_APB1RSTR_CANRST | RCC_APB1RSTR_USBRST | RCC_APB1RSTR_I2C2RST | RCC_APB1RSTR_I2C1RST |
RCC_APB1RSTR_USART4RST | RCC_APB1RSTR_USART3RST | RCC_APB1RSTR_USART2RST | RCC_APB1RSTR_SPI2RST |
RCC_APB1RSTR_WWDGRST | RCC_APB1RSTR_TIM14RST | RCC_APB1RSTR_TIM7RST | RCC_APB1RSTR_TIM6RST |
RCC_APB1RSTR_TIM3RST | RCC_APB1RSTR_TIM2RST;
RCC->APB2RSTR = RCC_APB2RSTR_DBGMCURST | RCC_APB2RSTR_TIM17RST | RCC_APB2RSTR_TIM16RST | RCC_APB2RSTR_TIM15RST |
RCC_APB2RSTR_USART1RST | RCC_APB2RSTR_SPI1RST | RCC_APB2RSTR_TIM1RST | RCC_APB2RSTR_ADCRST | RCC_APB2RSTR_SYSCFGRST;
RCC->AHBRSTR = 0;
RCC->APB1RSTR = 0;
RCC->APB2RSTR = 0;
Ср мар 11, 2020 17:51:58
void Jump2Boot(){
void (*SysMemBootJump)(void);
volatile uint32_t addr = 0x1FFFC800;
// reset systick
SysTick->CTRL = 0;
// reset clocks
RCC->APB1RSTR = RCC_APB1RSTR_CECRST | RCC_APB1RSTR_DACRST | RCC_APB1RSTR_PWRRST | RCC_APB1RSTR_CRSRST |
RCC_APB1RSTR_CANRST | RCC_APB1RSTR_USBRST | RCC_APB1RSTR_I2C2RST | RCC_APB1RSTR_I2C1RST |
RCC_APB1RSTR_USART4RST | RCC_APB1RSTR_USART3RST | RCC_APB1RSTR_USART2RST | RCC_APB1RSTR_SPI2RST |
RCC_APB1RSTR_WWDGRST | RCC_APB1RSTR_TIM14RST | RCC_APB1RSTR_TIM7RST | RCC_APB1RSTR_TIM6RST |
RCC_APB1RSTR_TIM3RST | RCC_APB1RSTR_TIM2RST;
RCC->APB2RSTR = RCC_APB2RSTR_DBGMCURST | RCC_APB2RSTR_TIM17RST | RCC_APB2RSTR_TIM16RST | RCC_APB2RSTR_TIM15RST |
RCC_APB2RSTR_USART1RST | RCC_APB2RSTR_SPI1RST | RCC_APB2RSTR_TIM1RST | RCC_APB2RSTR_ADCRST | RCC_APB2RSTR_SYSCFGRST;
RCC->AHBRSTR = 0;
RCC->APB1RSTR = 0;
RCC->APB2RSTR = 0;
// Enable the SYSCFG peripheral.
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN;
// remap memory to 0 (only for STM32F0)
SYSCFG->CFGR1 = 0x01; __DSB(); __ISB();
SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));
// set main stack pointer
__set_MSP(*((uint32_t *)addr));
// jump to bootloader
SysMemBootJump();
}
Ср мар 11, 2020 18:19:01
Чт апр 09, 2020 09:35:50
Example: with NE2 and A4, the LCD base address will be 0x6400 0000 and 0x6400 0020;
with NE4 and A0, the LCD base address will be 0x6C00 0000 and 0x6C00 0002.
Чт апр 09, 2020 09:55:21
Чт апр 09, 2020 10:14:55
Чт апр 09, 2020 10:24:45
У меня NE1 A18, правильно ли понял для 16 битного доступа 0x6000'0000 и 0x60080000?
Чт апр 09, 2020 11:33:02
#define LCD_DATA 0x60020000
#define LCD_REG 0x60000000
void Lcd_Write_Index(uint16_t index)
{
*(uint16_t *) (LCD_REG) = index;
}
////////////////////////
void Lcd_Write_Data(uint16_t data)
{
*(uint16_t *) (LCD_DATA)= data;
}
///////////////////
typedef struct
{
vu16 LCD_REG;
vu16 LCD_RAM;
} LCD_TypeDef;
#define LCD_BASE ((u32)(0x60000000 | 0x00080000))
#define LCD ((LCD_TypeDef *) LCD_BASE)
void LCD_WR_REG(u16 data)
{
LCD->LCD_REG=data;
}
void LCD_WR_DATA(u16 data)
{
LCD->LCD_RAM=data;
}
Чт апр 09, 2020 11:58:01
Чт апр 09, 2020 12:04:51
*(uint16_t *) (LCD_REG) = index;
Чт апр 09, 2020 12:05:54
Чт апр 09, 2020 13:39:05
И работать оно будет только для A0.
void LCD_WR_REG(u16 data)
{
*(uint16_t *) (LCD_REG) = data;
}
LCD_WR_REG(0xff00);
LCD_WR_DATA(0x80);
LCD_WR_REG(0xff01);
LCD_WR_DATA(0x09);
LCD_WR_REG(0xff02);
LCD_WR_DATA(0x01);
LCD_WR_REG(0xff80);
LCD_WR_DATA(0x80);
LCD_WR_REG(0xff81);
LCD_WR_DATA(0x09);
Чт апр 09, 2020 13:43:30
Чт апр 09, 2020 13:46:52
Чт апр 09, 2020 15:04:47
Чт апр 09, 2020 15:32:47
Чт апр 09, 2020 16:49:51
Вс апр 12, 2020 12:14:55
CAN->FMR = CAN_FMR_FINIT;
CAN->FA1R = CAN_FA1R_FACT0 | CAN_FA1R_FACT1;
CAN->sFilterRegister[0].FR1 = (1<<21)|(1<<5); // all odd IDs
CAN->FFA1R = 2; // filter 1 for FIFO1, filter 0 - for FIFO0
CAN->sFilterRegister[1].FR1 = (1<<21); // all even IDs
CAN->FMR &=~ CAN_FMR_FINIT;
Вс апр 12, 2020 16:38:25