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

sergei94

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

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

  • Посещение

Репутация

0 Обычный

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

  • Звание
    Частый гость
    Частый гость

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

1 687 просмотров профиля
  1. Hello,I have simulated the cirecuit bellow .i cant see the intuition behind the result. by logic that infinite rise time is high order harmonics so Z_c=1/jwcand Zc=0 if w is high so reflectencoefficient gamma will be -1 in that moment.But our impedance responce is only during thethe changes of in signal,DC has no effect.so when 50 ohms near it will take charge?because as i see it its always will see short in the load.Thanks.
  2. Hello, i am including rcc_config.h file which has the following functions as shown in the attached code. But Keil gives me the follwing errors what should i do with those warnings if i want to use thos functions in the H file inside main.c? Thanks. void SysClockConfig (void) { /****>>>>>>> STEPS FOLLOWED <<<<<<<<***** 1. ENABLE HSE and wait for the HSE to become Ready 2. Set the POWER ENABLE CLOCK and VOLTAGE REGULATOR 3. Configure the FLASH PREFETCH and the LATENCY Related Settings 4. Configure the PRESCALARS HCLK, PCLK1, PCLK2 5. Configure the MAIN PLL 6. Enable the PLL and wait for it to become ready 7. Select the Clock Source and wait for it to be set ********************/ #define PLL_M 4 #define PLL_N 180 #define PLL_P 0 // PLLP = 2 // 1. ENABLE HSE and wait for the HSE to become Ready RCC->CR |= RCC_CR_HSEON; // RCC->CR |= 1<<16; while (!(RCC->CR & RCC_CR_HSERDY)); // while (!(RCC->CR & (1<<17))); // 2. Set the POWER ENABLE CLOCK and VOLTAGE REGULATOR RCC->APB1ENR |= RCC_APB1ENR_PWREN; // RCC->APB1ENR |= 1<<28; PWR->CR |= PWR_CR_VOS; // PWR->CR |= 3<<14; // 3. Configure the FLASH PREFETCH and the LATENCY Related Settings FLASH->ACR = FLASH_ACR_ICEN | FLASH_ACR_DCEN | FLASH_ACR_PRFTEN | FLASH_ACR_LATENCY_5WS; // FLASH->ACR = (1<<8) | (1<<9)| (1<<10)| (5<<0); // 4. Configure the PRESCALARS HCLK, PCLK1, PCLK2 // AHB PR RCC->CFGR |= RCC_CFGR_HPRE_DIV1; // RCC->CFGR &= ~(1<<4); // APB1 PR RCC->CFGR |= RCC_CFGR_PPRE1_DIV4; // RCC->CFGR |= (5<<10); // APB2 PR RCC->CFGR |= RCC_CFGR_PPRE2_DIV2; // RCC->CFGR |= (4<<13); // 5. Configure the MAIN PLL RCC->PLLCFGR = (PLL_M <<0) | (PLL_N << 6) | (PLL_P <<16) | (RCC_PLLCFGR_PLLSRC_HSE); // (1<<22); // 6. Enable the PLL and wait for it to become ready RCC->CR |= RCC_CR_PLLON; // RCC->CR |= (1<<24); while (!(RCC->CR & RCC_CR_PLLRDY)); // while (!(RCC->CR & (1<<25))); // 7. Select the Clock Source and wait for it to be set RCC->CFGR |= RCC_CFGR_SW_PLL; // RCC->CFGR |= (2<<0); while ((RCC->CFGR & RCC_CFGR_SWS) != RCC_CFGR_SWS_PLL); // while (!(RCC->CFGR & (2<<2))); } void GPIO_Config (void) { /**** STEPS FOLLOWED ***** 1. Enable the GPIO CLOCK 2. Set the Pin as OUTPUT 3. Configure the OUTPUT MODE *************/ // 1. Enable the GPIO CLOCK //RCC->AHB1ENR |= (1<<0); RCC->AHB1ENR|=RCC_AHB1ENR_GPIODEN; // 2. Set the Pin as OUTPUT //GPIOA->MODER |= (1<<10); // pin PA5(bits 11:10) as Output (01) GPIOD->MODER &=~(0x1UL<<31U); GPIOD->MODER |=(0x1UL<<30U); // 3. Configure the OUTPUT MODE GPIOD->OTYPER = 0; GPIOD->OSPEEDR = 0; } void delay (volatile uint32_t time) { while (time--); } Build started: Project: less02_NO_HALL *** Using Compiler 'V6.15', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin' Build target 'Target 1' main.c(1): warning: In file included from... ./rcc_config.h(44): warning: no previous prototype for function 'SysClockConfig' [-Wmissing-prototypes] void SysClockConfig (void) ^ ./rcc_config.h(44): note: declare 'static' if the function is not intended to be used outside of this translation unit void SysClockConfig (void) ^ static ./rcc_config.h(99): warning: no previous prototype for function 'GPIO_Config' [-Wmissing-prototypes] void GPIO_Config (void) ^ ./rcc_config.h(99): note: declare 'static' if the function is not intended to be used outside of this translation unit void GPIO_Config (void) ^ static ./rcc_config.h(123): warning: no newline at end of file [-Wnewline-eof] } ^ ./rcc_config.h(119): warning: no previous prototype for function 'delay' [-Wmissing-prototypes] void delay (volatile uint32_t time) ^ ./rcc_config.h(119): note: declare 'static' if the function is not intended to be used outside of this translation unit void delay (volatile uint32_t time) ^ static 4 warnings generated. compiling main.c... linking... Program Size: Code=376 RO-data=408 RW-data=0 ZI-data=1632 ".\Objects\less02_NO_HALL.axf" - 0 Error(s), 4 Warning(s). Build Time Elapsed: 00:00:00
  3. Hello, I am using CUBEMX to define the clock of the periphery but when i used the HAL delay function i got the HAL_ delay be 100 times smaller. In the manual 1000 input is 1 second in HAL delay. How do i see the effect of the diagram bellow on the HAL DELAY function? I read about systick maybe affecting it.i am having trouble to link the CUBEMX diagram bellow and systic and delay of HAL_delay. Can i have a logical link between those elements? Thanks.
  4. Hello,when i put GPIOD->BSRR=(1uL<<15); out side of while(1) loop then it turns on the LED but when i put this line inside the while(1) then nothing happens. Where did i go wrong? Thanks. #include "stm32f407xx.h" //void delay2(int n) //{ // while(n>0) n--; // return; //} int main() { //RCC_AHB1ENR_GPIODEN RCC->AHB1ENR|=(1uL<<3); //set tirdbit //GPIOD->MODER&=~(1uL<<31);//reset 0 on 31 01 to gpio_moder 31,30 bits in register //GPIOD->MODER|=(1uL<<30);//set 1 on 30 output mode for pin 15 port D GPIOD->MODER=0x55000000; GPIOD->OTYPER=0; //all register is push pull GPIOD->OSPEEDR=0;//speed low //GPIOD->ODR|=(1<<15); //Sets pin 15 GPIOD->BSRR=(1uL<<15); while(1) { } }
  5. Hello, I am looking the API option in RTC to make the TICk independant of the operating system. How its called in the API of efr32fg14 shown bellow? Its a very delicate issue because In RT we need the tick to absuletly have no interference from the OS. Thanks. https://docs.silabs.com/mcu/latest/efr32fg14/group-RTCC
  6. Hello,In the API bellow there are series of functions which called SCANNING .The ADC is at chapter 28 of the reference manual.I cant imagine what is the meaning of this scanning?Thanks. https://www.silabs.com/documents/public/reference-manuals/efr32xg14-rm.pdfhttps://docs.silabs.com/mcu/latest/efr32fg14/group-ADC#gae145619e49706f16d4f495d7af61a362
  7. nodemcu is a very common device ,and i am really struggling for a long time with sending over wifi input spi data with python. I google many times this sort of combination and tryind to assemble the code.Is there a good manual which could show how exactly to broardcast over socket SPI data?Thanks. from machine import Pin,SPI import network import usocket as socket ap_if = network.WLAN(network.AP_IF) ssid = 'sensor_net' password = '123456789' ap_if.active(True) ap_if.config(essid=ssid, password=password) s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.bind(('',80)) s.listen(5) spi=SPI(1, baudrate=1000000, polarity=0, phase=0) while True: spi.write(b'1234') conn, addre=s.accept() request='<p style="color:red"><u><h1>The temperature is:</u></p>' request2=str(12.7) response='gyhkjgku' conn.send('HTTP/1.1 200 OK\n') conn.send('Content-type: text/html\n') conn.send('Connection: close\n\n') conn.sendall(request) conn.sendall(request2) conn.close() spi.write(b'1234')
  8. Hello, i have used UBUNTU VM and NONOS SDK to run the code bellow, in the ubuntu VM (with a share forlder of C:\Users\Asus\VirtualBox VMs\share\ESP8266_NONOS_SDK-3.0.4\bin)It gave me a long output which in the end showedGenerate eagle.flash.bin and eagle.irom0text.bin successullyin folder bin. eagle.flash.bin-------->0x00000 eagle.irom0text.bin---->0x10000 !!!in the C:\Users\Asus\VirtualBox VMs\share\ESP8266_NONOS_SDK-3.0.4\bin i see these generated files.My nodemcu connect to PC COM6 using micro usb cablewhat can i do next to see that "hellow world" ?Thanks. ESPRESSIF MIT License * * Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD> * * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case, * it is free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the Software is furnished * to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or * substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "ets_sys.h" #include "osapi.h" #include "user_interface.h" #if ((SPI_FLASH_SIZE_MAP == 0) || (SPI_FLASH_SIZE_MAP == 1)) #error "The flash map is not supported" #elif (SPI_FLASH_SIZE_MAP == 2) #define SYSTEM_PARTITION_OTA_SIZE 0x6A000 #define SYSTEM_PARTITION_OTA_2_ADDR 0x81000 #define SYSTEM_PARTITION_RF_CAL_ADDR 0xfb000 #define SYSTEM_PARTITION_PHY_DATA_ADDR 0xfc000 #define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0xfd000 #elif (SPI_FLASH_SIZE_MAP == 3) #define SYSTEM_PARTITION_OTA_SIZE 0x6A000 #define SYSTEM_PARTITION_OTA_2_ADDR 0x81000 #define SYSTEM_PARTITION_RF_CAL_ADDR 0x1fb000 #define SYSTEM_PARTITION_PHY_DATA_ADDR 0x1fc000 #define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0x1fd000 #elif (SPI_FLASH_SIZE_MAP == 4) #define SYSTEM_PARTITION_OTA_SIZE 0x6A000 #define SYSTEM_PARTITION_OTA_2_ADDR 0x81000 #define SYSTEM_PARTITION_RF_CAL_ADDR 0x3fb000 #define SYSTEM_PARTITION_PHY_DATA_ADDR 0x3fc000 #define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0x3fd000 #elif (SPI_FLASH_SIZE_MAP == 5) #define SYSTEM_PARTITION_OTA_SIZE 0x6A000 #define SYSTEM_PARTITION_OTA_2_ADDR 0x101000 #define SYSTEM_PARTITION_RF_CAL_ADDR 0x1fb000 #define SYSTEM_PARTITION_PHY_DATA_ADDR 0x1fc000 #define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0x1fd000 #elif (SPI_FLASH_SIZE_MAP == 6) #define SYSTEM_PARTITION_OTA_SIZE 0x6A000 #define SYSTEM_PARTITION_OTA_2_ADDR 0x101000 #define SYSTEM_PARTITION_RF_CAL_ADDR 0x3fb000 #define SYSTEM_PARTITION_PHY_DATA_ADDR 0x3fc000 #define SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR 0x3fd000 #else #error "The flash map is not supported" #endif static const partition_item_t at_partition_table[] = { { SYSTEM_PARTITION_BOOTLOADER, 0x0, 0x1000}, { SYSTEM_PARTITION_OTA_1, 0x1000, SYSTEM_PARTITION_OTA_SIZE}, { SYSTEM_PARTITION_OTA_2, SYSTEM_PARTITION_OTA_2_ADDR, SYSTEM_PARTITION_OTA_SIZE}, { SYSTEM_PARTITION_RF_CAL, SYSTEM_PARTITION_RF_CAL_ADDR, 0x1000}, { SYSTEM_PARTITION_PHY_DATA, SYSTEM_PARTITION_PHY_DATA_ADDR, 0x1000}, { SYSTEM_PARTITION_SYSTEM_PARAMETER, SYSTEM_PARTITION_SYSTEM_PARAMETER_ADDR, 0x3000}, }; void ICACHE_FLASH_ATTR user_pre_init(void) { if(!system_partition_table_regist(at_partition_table, sizeof(at_partition_table)/sizeof(at_partition_table[0]),SPI_FLASH_SIZE_MAP)) { os_printf("system_partition_table_regist fail\r\n"); while(1); } } /** * @brief Test spi interfaces. * */ void ICACHE_FLASH_ATTR user_init(void) //entry { os_printf("Hello World\r\n"); } Last edited: 10 minutes ago Quote ReplyReport Edit
  9. Hello i have installed eclipse and the espressif sdk and the example blinky 2 worked great as shown in code 1 bellow. Then i have found a manual serias of narodstream ep5 shown bellow which gives the code shown bellow called code 2 https://narodstream.ru/esp8266-urok-5-nastraivaem-toolchain-i-pishem-svoyu-proshivku-v-ide-eclipse-chast-1/ When i Complied code 2 instead of the bilinky 2 code 1 it showed no error,but it didnt blink either. I think its because we used the wrong GPIO. I cant understand the meaning of the CODE2 there is flash stuff, and ATTR,flash map PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2); gpio_output_set(0, 0, (1 << LED), 0); What kind of code it is? it differs alot from EFR32 simplisity studio. Is there some place i cant learn the meaning of these terms? Code 1 /* The blinky demo using an os timer TODO : work out why this resets after a while */ #include <ets_sys.h> #include <osapi.h> #include <os_type.h> #include <gpio.h> // see eagle_soc.h for these definitions #define LED_GPIO 2 #define LED_GPIO_MUX PERIPHS_IO_MUX_GPIO2_U #define LED_GPIO_FUNC FUNC_GPIO2 #define DELAY 100 /* milliseconds */ LOCAL os_timer_t blink_timer; LOCAL uint8_t led_state=0; LOCAL void ICACHE_FLASH_ATTR blink_cb(void *arg) { GPIO_OUTPUT_SET(LED_GPIO, led_state); PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U,FUNC_GPIO12); led_state ^=1; } void user_rf_pre_init(void) { } void user_init(void) { // Configure pin as a GPIO PIN_FUNC_SELECT(LED_GPIO_MUX, LED_GPIO_FUNC); // Set up a timer to blink the LED // os_timer_disarm(ETSTimer *ptimer) os_timer_disarm(&blink_timer); // os_timer_setfn(ETSTimer *ptimer, ETSTimerFunc *pfunction, void *parg) os_timer_setfn(&blink_timer, (os_timer_func_t *)blink_cb, (void *)0); // void os_timer_arm(ETSTimer *ptimer,uint32_t milliseconds, bool repeat_flag) os_timer_arm(&blink_timer, DELAY, 1); } Code 2 #include <stdio.h> #include "ets_sys.h" #include "user_interface.h" #include "gpio.h" //------------------------------------------------------ #define LED 2 //------------------------------------------------------ void delay(uint32_t count ) { while(--count); } //------------------------------------------------------ uint32 ICACHE_FLASH_ATTR user_rf_cal_sector_set(void) { enum flash_size_map size_map = system_get_flash_size_map(); uint32 rf_cal_sec = 0; switch (size_map) { case FLASH_SIZE_4M_MAP_256_256: rf_cal_sec = 128 - 8; break; case FLASH_SIZE_8M_MAP_512_512: rf_cal_sec = 256 - 5; break; case FLASH_SIZE_16M_MAP_512_512: case FLASH_SIZE_16M_MAP_1024_1024: rf_cal_sec = 512 - 5; break; case FLASH_SIZE_32M_MAP_512_512: case FLASH_SIZE_32M_MAP_1024_1024: rf_cal_sec = 1024 - 5; break; default: rf_cal_sec = 0; break; } return rf_cal_sec; } //------------------------------------------------------ void ICACHE_FLASH_ATTR user_init() { gpio_init(); PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2); gpio_output_set(0, 0, (1 << LED), 0); while(1) { delay(1000000); system_soft_wdt_feed(); gpio_output_set(0, (1 << LED), 0, 0); delay(1000000); system_soft_wdt_feed(); gpio_output_set((1 << LED), 0, 0, 0); } } //------------------------------------------------------
  10. From I2C communication with Si7021 sensor i got 3 bytes as a result. MS LS and checksum as shown in the manual bellow. But how do i validate using checksum my MS and LS bytes. I know that each device has unique condition. How do i accomplish that? Thanks. https://www.silabs.com/documents/public/data-sheets/Si7021-A20.pdf
  11. Hello,I want my NodeMcu to broadcast recieved data from SPI to wifi. I need to use interrupt of recieve and to broadcast. In the manual bellow there is no slave SPI for Node mcu. Is there some manual i could use to accomplish it? Thanks https://diyi0t.com/spi-tutorial-for-arduino-and-esp8266/
  12. How do know that i need to connect extra small pullups?How i see that SCL is too bad?Thanks.
  13. The schematics of the board shown bellow. there is an intresting point TS3A4651 is a switch. my SCL and SDA outputs are SCL PortC 10 ,and SDA is PortC 11 by the datshee bellow. But i dont know where in my ports on the schemtics? How i connect these pullup to them?(if this is the correct solution) https://www.silabs.com/documents/public/schematic-files/WSTK-Main-BRD4001A-A01-schematic.pdf https://www.silabs.com/documents/public/data-sheets/efr32fg14-datasheet.pdf
  14. Hello ,I am using efr32fg14 starter kit,i have defined gpio to be as shown bellow.I clock a rounded clock shape as shown in the print screen bellow. I am already using pullup ressistor for my GPIO. obviosly the rise time is too slow,i have added the full code bellow,what coul be done to make the clock shape better? Thanks. GPIO_PinModeSet(gpioPortC, 10, gpioModeWiredAndPullUp, 1); GPIO_PinModeSet(gpioPortC, 11, gpioModeWiredAndPullUp, 1); #include "stddef.h" #include "em_system.h" #include "em_device.h" #include "em_chip.h" #include "em_cmu.h" #include "em_emu.h" #include "em_gpio.h" #include "i2cspm.h" #include "si7013.h" #include "sl_sleeptimer.h" #include "graphics.h" #include "em_adc.h" #include "bspconfig.h" uint8_t com1[1] = {0xE3}; uint8_t i2c_rxBuffer[3]; int main(void) { I2C_TransferSeq_TypeDef i2cTransfer; I2C_TransferReturn_TypeDef result; I2CSPM_Init_TypeDef i2cInit = I2CSPM_INIT_DEFAULT; /* Chip errata */ CHIP_Init(); // Enabling clock to the I2C, GPIO, LE CMU_ClockEnable(cmuClock_I2C0, true); CMU_ClockEnable(cmuClock_GPIO, true); CMU_ClockEnable(cmuClock_HFLE, true); // Starting LFXO and waiting until it is stable CMU_OscillatorEnable(cmuOsc_LFXO, true, true); I2CSPM_Init(&i2cInit); // In order to enable the I2C0_SCL function in PC10 you need to use ROUTE 14 // In order to enable the I2C0_SDA function in PC11 you need to use ROUTE 16 //Also note that there's a GPIO pin PD15 that need to be set to high in order to route the signals to the sensor, // Using PC10 (SCL) and PC11 (SDA) GPIO_PinModeSet(gpioPortC, 10, gpioModeWiredAndPullUp, 1); GPIO_PinModeSet(gpioPortC, 11, gpioModeWiredAndPullUp, 1); //Si7021 switch on GPIO_PinModeSet(gpioPortD, 15, gpioModePushPull, 1); // Enable pins at location 15 as specified in datasheet I2C0->ROUTEPEN = I2C_ROUTEPEN_SDAPEN | I2C_ROUTEPEN_SCLPEN; I2C0->ROUTELOC0 = (I2C0->ROUTELOC0 & (~_I2C_ROUTELOC0_SDALOC_MASK)) | I2C_ROUTELOC0_SDALOC_LOC16; I2C0->ROUTELOC0 = (I2C0->ROUTELOC0 & (~_I2C_ROUTELOC0_SCLLOC_MASK)) | I2C_ROUTELOC0_SCLLOC_LOC14; i2cTransfer.flags=I2C_FLAG_WRITE_READ; i2cTransfer.addr=0x80;//address with write i2cTransfer.buf[0].data=com1[0]; // Measure Temperature, Hold Master Mode i2cTransfer.buf[0].len=2; //2 bytes length i2cTransfer.buf[1].data=i2c_rxBuffer; i2cTransfer.buf[1].len=3; //LS MS checksum while(1) { result=I2C_TransferInit(I2C0,&i2cTransfer); // Sending data while (result == i2cTransferInProgress) { result = I2C_Transfer(I2C0); } } }
×
×
  • Создать...