- Motorola Edge 40 - jó bőr
- Samsung Galaxy A33 5G - a három az majdnem öt
- Samsung Galaxy A52s 5G - jó S-tehetség
- Android alkalmazások - szoftver kibeszélő topik
- Hónap végén érkezik a Xiaomi Band 10, ára is van
- Samsung Galaxy A34 - plus size modell
- Hat év támogatást csomagolt fém házba a OnePlus Nord 4
- Samsung Galaxy Watch7 - kötelező kör
- Extra erő egy gombnyomásra - Engwe EP-2 Boost
- Mobilinternet EU-n kívül, eSIM adatcsomagok használata
-
Mobilarena
Arduino hardverrel és szoftverrel foglakozó téma. Minden mikrovezérlő ami arduinoval programozható, és minden arduino program, board, és hardverrel kapcsolatos kérdések helye.
Új hozzászólás Aktív témák
-
Janos250
őstag
válasz
Teasüti #10212 üzenetére
Olvastam én, csak eddig nem volt időm rá, de most összeütöttem.
RMT-vel hogy csinálnál mondjuk 100 Hz 50% PWM jelet?
Így:
Bár most látom, hogy Te 100 Hz-et kérdeztél, én meg 10 kHz-re emlékeztem. Sebaj, átírhatja, akit érdekel.Ha nem kell carrier, akkor ki kell kommentelni
// 10 kHz RMT
const uint8_t GPIOnum = 15;
const uint8_t RMTchNum = 0;
const uint8_t DutyCycle = 50 ; // %
const uint32_t freq = 10000 ;
const uint32_t clockAPBbus = 80000000 ; // RMT use APB bus clock
const uint16_t highCiklNum = (uint16_t) ( clockAPBbus / freq / 100 * DutyCycle ) ;
const uint16_t lowCiklNum = (uint16_t) ( clockAPBbus / freq / 100 * (100 - DutyCycle) ) ;
const uint32_t RMTdata = ( ( (lowCiklNum) <<16) + (1<<15) + highCiklNum) ;
void setup() {
Serial.begin(115200);
delay(1000);
Serial.println("start setup");
pinMode(GPIOnum, OUTPUT);
*((volatile uint32_t *) (0x3FF44530 + GPIOnum * 4 )) = 0x57 + RMTchNum ;
*((volatile uint32_t *) (0x3FF000C0)) |= 1 << 9 ;
*((volatile uint32_t *) (0x3FF000C4)) &= (~(1 << 9)) ;
*((volatile uint32_t *) (0x3FF560F0)) |= 1 ;
*((volatile uint32_t *) (0x3FF560F0)) |= 2 ;
*((volatile uint32_t *) (0x3FF56020 + RMTchNum*8)) = 1 ;
*((volatile uint32_t *) (0x3FF56020 + RMTchNum*8)) |= (1 << 24) ;
*((volatile uint32_t *) (0x3FF560B0 + RMTchNum*8)) = ( (0x80 << 16) + 0x80) ; // carrier freq
*((volatile uint32_t *) (0x3FF56020 + RMTchNum*8)) |= (1 << 28) ; // carrier enable
*((volatile uint32_t *) (0x3FF56024 + RMTchNum*8)) = (1 << 17) ;
*((volatile uint32_t *) (0x3FF56024 + RMTchNum*8)) |= (1 << 3) ;
for (uint16_t i = 0 ; i<(64) ; i++ ){
*((volatile uint32_t *) (0x3FF56800 + RMTchNum *64 * 4 + i*4)) = RMTdata ;
};
*((volatile uint32_t *) (0x3FF56024 + RMTchNum*8)) |= 1 ;
Serial.println("end setup");
delay(500) ;
} // end setup
void loop() {
delay(1000) ;
} ; // end loop
/*
Comments:
*((volatile uint32_t *) (0x3FF44530 + GPIOnum * 4 )) = 0x57 + RMTchNum ; // GPIOnum output = RMT CH RMTchNum
// p 58 (Tech. Ref, 4.12 Register Summary)
// 0x3FF44530 = Peripheral output selection for GPIO_0 (GPIO_FUNC0_OUT_SEL_CFG_REG)
// (0x3FF44530 + GPIOnum * 4 ) = Peripheral output selection for GPIOnum
// 87 (0x57) = rmt_sig_out0 (p. 53 , 4.9 Peripheral Signal List)
// GPIO_FUNC2_OUT_SEL_CFG_REG
*((volatile uint32_t *) (0x3FF000C0)) |= 1 << 9 ; // BIT9, Remote Controller (p. 93)
// DPORT registers/DPORT_PERIP_CLK_EN_REG =1 : enables the peripheral clock (p 92.)
// PERIP_CLK_EN_REG (p. 95 , 5.4 DPort Register Summary)
// BIT9, Remote Controller
// DPORT_RMT_CLK_EN = bit 9 = 0x200
*((volatile uint32_t *) (0x3FF000C4)) &= (~(1 << 9)) ; // PERIP_RST_EN_REG reset for peripherals (p 95)
// BIT9 = DPORT_RMT_RST (RMT reset)
// DPORT registers/PERIP_RST_EN_REG = reset for peripherals
// DPORT_PERIP_RST_EN_REG = (DR_REG_DPORT_BASE + 0x0C4) = 0x3FF000C4
*((volatile uint32_t *) (0x3FF560F0)) |= 1 ; // bit 0 RMT_APB_CONF_REG 1 = Set this bit to disable apb fifo access
// RMT_APB_CONF_REG / bit 0 RMT_MEM_ACCESS_EN Set this bit to disable apb fifo access
// This bit must be 1 in order to access the RMT memory (p. 402.)
*((volatile uint32_t *) (0x3FF560F0)) |= 2 ;
// RMT_APB_CONF_REG / bit 1 RMT_MEM_TX_WRAP_EN This bit enables wraparound mode: when the transmitter of a channel
// has reached the end of its memory block, it will resume sending at the start of its memory region
// RMT_CHxCONF0_REG 15. Remote Control Peripheral/ 15.3 Register Summary (p 396, 397.):
*((volatile uint32_t *) (0x3FF56020 + RMTchNum*8)) = 1 ; // frequency divider's factor , bit7-0 (p. 396)
// freq = 80 Mhz / 1
*((volatile uint32_t *) (0x3FF56020 + RMTchNum*8)) |= (1 << 24) ; // memory blocks allocated to channel , bit27-24
*((volatile uint32_t *) (0x3FF560B0 + RMTchNum*8)) = ( (0x80 << 16) + 0x80) ; // carrier freq
*((volatile uint32_t *) (0x3FF56020 + RMTchNum*8)) |= (1 << 28) ; // carrier enable
*((volatile uint32_t *) (0x3FF56024 + RMTchNum*8)) = (1 << 17) ; // CLK = 80 Mhz
// bit 17: RMT_CHxCONF1_REG / RMT_REF_ALWAYS_ON_CHn
*((volatile uint32_t *) (0x3FF56024 + RMTchNum*8)) |= (1 << 3) ;
// bit 3 : RMT_CHxCONF1_REG / RMT_MEM_RD_RST_CHn Set this bit to reset the read-RAM address
// for channel n by accessing the transmitter
for (uint16_t i = 0 ; i<(64) ; i++ ){
*((volatile uint32_t *) (0x3FF56800 + RMTchNum *64 * 4 + i*4)) = RMTdata ;
};
*((volatile uint32_t *) (0x3FF56024 + RMTchNum*8)) |= 1 ;
// bit 0 : RMT_CHxCONF1_REG / RMT_TX_START_CHn . Set this bit to start sending data on channel n
*/
Új hozzászólás Aktív témák
- Milyen házat vegyek?
- Túra és kirándulás topic
- Motorola Edge 40 - jó bőr
- Samsung Galaxy A33 5G - a három az majdnem öt
- AMD Ryzen 9 / 7 / 5 9***(X) "Zen 5" (AM5)
- Milyen asztali (teljes vagy fél-) gépet vegyek?
- OLED monitor topik
- sziku69: Fűzzük össze a szavakat :)
- sziku69: Szólánc.
- Luck Dragon: Asszociációs játék. :)
- További aktív témák...
- UF Lenovo Yoga 9i x360 Érintős Hajtogatós Laptop Tab 14" -60% i7-1360P 16/1TB Iris Xe 2,8K OLED 90Hz
- Lenovo Yoga 9i x360 Érintős Hajtogatós Laptop Tab 14" -60% i7-1260P 16/512 Iris Xe 2,8K OLED 90Hz
- Új DELL Inspiron 16 Fémházas Multimédiás Laptop 16" -40% Ryzen 7 8840U 8mag 16/1TB FHD+ IPS
- Új DELL Inspiron 16 Fémházas Multimédiás Laptop 16" -40% Ryzen 7 8840U 8mag 16/1TB FHD+ IPS
- Sony FE 28-70 mm F3.5-5.6 OSS
- iKing.Hu - Samsung S25 Ultra - Titanium Black - Használt, karcmentes
- Lenovo Yoga Pro 9 (16IMH9) - Intel Core Ultra 9 185H, RTX 4060, 32GB, érintős ELKELT
- Csere-Beszámítás! Asus Tuf RTX 5070Ti 16GB GDDR7 Videokártya! Bemutató darab!
- ÖRÖK GARANCIÁVAL - OLCSÓ, LEGÁLIS SZOFTVEREK 0-24 KÉZBESÍTÉSSEL - Windows - Office - LicencAruhaz.hu
- AKCIÓ! Gigabyte B85-HD3 B85 chipset alaplap garanciával hibátlan működéssel
Állásajánlatok
Cég: CAMERA-PRO Hungary Kft
Város: Budapest
Cég: PC Trade Systems Kft.
Város: Szeged