Jump to content

    

sergei94

Участник
  • Content Count

    118
  • Joined

  • Last visited

Community Reputation

0 Обычный

About sergei94

  • Rank
    Частый гость

Recent Profile Visitors

1018 profile views
  1. 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/
  2. How do know that i need to connect extra small pullups?How i see that SCL is too bad?Thanks.
  3. 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
  4. 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); } } }
  5. Hello I have written a code for getting data from Si7021 sensor.I see on my scope I2C transmition on SDA and SCL . As you can see in the photo bellow i2c_rxBuffer is the array where the data is being recieved. But as you can see bellow in the debuf mode there is no i2c_rxBuffer variable. Where can i see it? Thanks. #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); } } }
  6. Ok so the idia is to put calibration these 24 bits in this register and my HFRCO will be the value we want :-) Thanks.
  7. I got to some insights with this github example code. The LFXO is selected to be HFCLK which goes to I2C and GPIO peripherals. The big problem is How they choose the variable CORE_FREQUENCY is the frequesncy of LFXO? Another question is regarding this line i2cInit.freq = I2C_FREQ_FAST_MAX As you said we take a clock and prescale it over and over till it flows as water threw I2C peripheral.How can we demand certain number from I2C ? if we choose a different external clock after prescaling we will get different clock in I2C Thanks. https://github.com/SiliconLabs/peripheral_examples/blob/master/series1/i2c/i2c/src/main_efr.c
  8. Hello, in the link bellow we have I2C example of efr32. There are 3 components that i am having trouble to seehow they work together. The only clock diagram i found is in page 281 of reference manual shown bellow. i cant see where the CORE_FREQUENCY goes? why we enable HFLE LFXO I2c gpio ? how its all allowing the final line i2cInit.freq = I2C_FREQ_FAST_MAX I cant see the big picture behind it. I'll be glad to have some intuition i could use to understand this mechanism. Thanks. https://www.silabs.com/documents/public/reference-manuals/efr32xg14-rm.pdf 1. #define CORE_FREQUENCY 14000000 2. // 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); 3. i2cInit.freq = I2C_FREQ_FAST_MAX https://github.com/SiliconLabs/peripheral_examples/blob/master/series1/i2c/i2c/src/main_efr.c
  9. Hello Obam,I know that every register has an offset so as i see it . i should do first is to save the last 8 bits in the register and then put in the first 24 places 0x08. CMU_HFRCOCTRL=CMU_HFRCOCTRL&F000 ; CMU_HFRCOCTRL=CMU_HFRCOCTRL&(0x080); I hope i got the idia correctly. How can i test the HFRCO clock on my efr32fg14 starter kit board? Thanks.
  10. Hello Obam,So in order to set the HFRCO to be 4Mhz we need to put in the register 0x080. But 0x080 is 24 bits where as the register is 32 bits. Do i put those 24bits in the first 24 places of the register? Thanks.
  11. Hello, HFRCO can take many forms 4,7,13Mhz i want to set it to be 4MHz.I have found the following tables in the reference manual.But where is the register in which we can choose HFRCO frequency. How can i set HFRCO frequency? Thanks. https://www.silabs.com/documents/public/reference-manuals/efr32xg14-rm.pdf
  12. Hello Obam, At page 281 of the manual we have the following diagram. Which basicly say that we coud take HFRCO and divide its frequency by a prescaler to get the desire results. So the question which arrises is what is the exact value of HFRCO?(i cant see it in the manual) ON page 350 We see a prescaler which is not in the diagram. SO i am confused. If you could please help me with the value of the highest point and what path to follow for I2C HFPECLK. Thanks.
  13. i promise you i did not use google translate :-) i did my best to express myself.