Перейти к содержанию
    

mcheb

Участник
  • Постов

    393
  • Зарегистрирован

  • Посещение

Репутация

0 Обычный

Информация о mcheb

  • Звание
    Местный
    Местный

Посетители профиля

4 826 просмотров профиля
  1. Как-то так надо void initBoard(void) { RCC->APB2ENR = RCC_APB2ENR_IOPAEN + 1*RCC_APB2ENR_IOPBEN + 1*RCC_APB2ENR_IOPCEN + 0*RCC_APB2ENR_IOPDEN + 0*RCC_APB2ENR_USART1EN + RCC_APB2ENR_AFIOEN; AFIO->MAPR = AFIO_MAPR_SWJ_CFG_JTAGDISABLE;
  2. eep это область памяти, а секции в ней размещаются. А переменные размещаются в секциях. __attribute__ ((section(".моясекция"))) А проще в Makefile прописать LDFLAGS += -Wl,--section-start=.моясекция=МОЙАДРЕС
  3. FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K отрезать флешь , параметр LENGTH
  4. /* ***************************************************************************** ** ** File : LinkerScript.ld ** ** Abstract : Linker script for STM32F103RGTx Device with ** 1024KByte FLASH, 96KByte RAM ** ** Set heap size, stack size and stack location according ** to application requirements. ** ** Set memory bank area and size if external memory is used. ** ** Target : STMicroelectronics STM32 ** ** ** Distribution: The file is distributed as is, without any warranty ** of any kind. ** ** (c)Copyright Ac6. ** You may use this file as-is or modify it according to the needs of your ** project. Distribution of this file (unmodified or modified) is not ** permitted. Ac6 permit registered System Workbench for MCU users the ** rights to distribute the assembled, compiled & linked contents of this ** file as part of an application binary file, provided that it is built ** using the System Workbench for MCU toolchain. ** ***************************************************************************** */ /* Entry Point */ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ _estack = 0x20018000; /* end of RAM */ /* Generate a link error if heap and stack don't fit into RAM */ _Min_Heap_Size = 0x200; /* required amount of heap */ _Min_Stack_Size = 0x400; /* required amount of stack */ /* Specify the memory areas */ MEMORY { RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K /* eep (rx) : ORIGIN = 0x08000000 +31*1024, LENGTH = 1K */ } /* Define output sections */ SECTIONS { /* The startup code goes first into FLASH */ .isr_vector : { . = ALIGN(4); KEEP(*(.isr_vector)) /* Startup code */ . = ALIGN(4); } >FLASH /* The program code and other data goes into FLASH */ .text : { . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.glue_7) /* glue arm to thumb code */ *(.glue_7t) /* glue thumb to arm code */ *(.eh_frame) KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); _etext = .; /* define a global symbols at end of code */ } >FLASH /* .eeprom : { *(.eeprom) } > eep */ /* Constant data goes into FLASH */ .rodata : { . = ALIGN(4); *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ . = ALIGN(4); } >FLASH .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH .ARM : { __exidx_start = .; *(.ARM.exidx*) __exidx_end = .; } >FLASH .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >FLASH .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >FLASH .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(SORT(.fini_array.*))) KEEP (*(.fini_array*)) PROVIDE_HIDDEN (__fini_array_end = .); } >FLASH /* used by the startup to initialize data */ _sidata = LOADADDR(.data); /* Initialized data sections goes into RAM, load LMA copy after code */ .data : { . = ALIGN(4); _sdata = .; /* create a global symbol at data start */ *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); _edata = .; /* define a global symbol at data end */ } >RAM AT> FLASH /* Uninitialized data section */ . = ALIGN(4); .bss : { /* This is used by the startup in order to initialize the .bss secion */ _sbss = .; /* define a global symbol at bss start */ __bss_start__ = _sbss; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = _ebss; } >RAM /* User_heap_stack section, used to check that there is enough RAM left */ ._user_heap_stack : { . = ALIGN(8); PROVIDE ( end = . ); PROVIDE ( _end = . ); . = . + _Min_Heap_Size; . = . + _Min_Stack_Size; . = ALIGN(8); } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } .ARM.attributes 0 : { *(.ARM.attributes) } } Раскомментировать секцию eep (.eeprom )
  5. Так работает const uint8_t eeLoggerName[] __attribute__ ((section(".config"))) = { '1','.','0','\0', }; и линкеру указать опцию LDFLAGS += -Wl,--section-start=.config=0x8010000 или в ld файле прописать эту секцию .config
  6. 25Вт/(0,14А**2) = 1275 Ом. При 5000ВА такой трансформатор как работает?
  7. Самый лучший - CCS PCWHD (PIC C Compiler) – компилятор языка С. Но платный.
  8. Прочитал из интернета This is a generic routine which uses the active UART module previously activated by the UART_Set_Active routine. UART_Set_Active вызывается?
  9. В аналоговой системе величина сопротивления является адресом. Это позволяет (удешевляет) уменьшить количество проводов.
  10. https://www.st.com/en/development-tools/stm8cubemx.html Для любителей Куба
  11. Вот так работает /* USB report descriptor */ const uint8_t usbDescReport[] = { 0x06, 0xFF, 0x00, /* USAGE_PAGE (Vendor Page: 0xFF00) */ 0x09, 0x01, /* USAGE (1) */ 0xa1, 0x01, /* COLLECTION (Application) */ // 0x15, 0x00, /* LOGICAL_MINIMUM (0) */ // 0x26, 0xff, 0x00, /* LOGICAL_MAXIMUM (255) */ 0x75, 0x08, /* REPORT_SIZE bits*/ 0x95, USB_HID_SIZE-1, /* REPORT_COUNT bytes*/ /* IN --> 1+1+62 bytes */ 0x85, IN_REPORT_ID, /* REPORT_ID */ 0x09, IN_REPORT_ID, /* USAGE */ // 0x95, USB_IN_SIZE-1, /* REPORT_COUNT */ 0x81, 0x02, // INPUT (Data,Variable,Abs) /* OUT 1+1+62 bytes */ 0x85, OUT_REPORT_ID, /* REPORT_ID*/ 0x09, OUT_REPORT_ID, /* USAGE */ // 0x95, USB_OUT_SIZE-1, /* REPORT_COUNT */ 0x91, 0x02, // OUTPUT(Data, Variable,Abs // feature in-out report 0x85, FEATURE_REPORT_ID,/* REPORT_ID */ 0x09, FEATURE_REPORT_ID, /* USAGE */ // 0x95, USB_OUT_SIZE-1, /* REPORT_COUNT */ 0xB1, 0x02, // Feature (Data, Variable,Abs) 0xc0 /* END_COLLECTION */ } /** BOOTLOADER function */ void usbHidRead(void) { uint8_t buf[USB_HID_SIZE]; uint16_t cnt,i; cnt = usbReadOutEp(buf,FreeCnt(&rxFifo)); if(cnt != 0) { if(buf[1] > 0) { /** buf[0] Report ID buf[1] - data length */ for(i=0; i<buf[1]; i++) InsChar(buf[i+2]); // usbSetUartIrq(); } } } /** BOOTLOADER function */ void usbHidSend(void) { uint8_t buf[USB_HID_SIZE]; uint16_t cnt=0; buf[0] = IN_REPORT_ID; /** Report ID */ for(cnt=2; cnt<USB_HID_SIZE;) { if(WaitCnt(&txFifo) == 0) break; else buf[cnt++] = ReqChar(); } if(cnt > 2) { buf[1] = cnt-2; pUsb.sendFlag = 1; // prtBuf("SendToHost: ",(void *)(buf+1),cnt-1); usbWriteInEp(buf,USB_HID_SIZE); } else pUsb.sendFlag = 0; }
  12. Вместо ЦАП придётся использовать ШИМ. Тоже всё станет ясно
  13. В контроллере есть это, вместо сигнала подать это и посмотреть, где ошибка 12.2 DAC main features • Two DAC converters: one output channel each • Left or right data alignment in 12-bit mode • Synchronized update capability • Noise-wave generation • Triangular-wave generation • Dual DAC channel independent or simultaneous conversions • DMA capability for each channel • External triggers for conversion • Input voltage reference V REF+ The block diagram of a DAC channel is shown in Figure 40 and the pin description is given in Table 73.
  14. https://ru.aliexpress.com/item/4000135607421.html?scm=1007.23534.124000.0&amp;pvid=88f8f056-830a-462a-bf4b-ed4af1465cc3&amp;rmsg=do_not_replacement&amp;dp=71cd5751deab77497b8ffa74e8bfaf4f&amp;af=843361&amp;cv=47843&amp;afref=&amp;mall_affr=pr3&amp;aff_platform=aaf&amp;cpt=1576203012634&amp;sk=VnYZvQVf&amp;aff_trace_key=f50e3ccf969e4c53b91a0da99570b7f8-1576203012634-00684-VnYZvQVf&amp;terminal_id=522599cd9c3942d1b88b753394b28995
×
×
  • Создать...