hybridfree/eevblog-posts huggingface dataset:
configuring STM32 using STM32CubeMX - Page 1
Forum section: electronics / general

author: Mtech1
author_rank: Contributor
timestamp: March 20, 2023, 08:34:50 am
content: I am trying to configure external clock(HSE) for STM32l152ccu6 using STM32CubeMX,Code:* The system Clock is configured as follow :* System Clock source = PLL (HSE)* SYSCLK(Hz) = 72000000* HCLK(Hz) = 72000000* AHB Prescaler = 1* APB1 Prescaler = 2* APB2 Prescaler = 1* HSE Frequency(Hz) = 25000000* HSE PREDIV1 = 5* HSE PREDIV2 = 5* PLL2MUL = 8* Flash Latency(WS) = 2https://community.st.com/s/article/how-to-use-stm32cubemX-to-configure-high-speed-external-oscillator-and-low-speed-external-oscillatorI am not sure I am setting correct value any help please

author: luiHS
author_rank: Frequent Contributor
timestamp: March 20, 2023, 09:21:31 am
content: For 32 MHz:PLL Source HSE (24 MHz)PLL Mult X4PLL Div /3

author: Mtech1
author_rank: Contributor
timestamp: March 20, 2023, 10:41:24 am
content: Quote from: luiHS on March 20, 2023, 09:21:31 amstill I don't fully understand GUI configuration to configure clockPlease find attached screenshot

author: wek
author_rank: Frequent Contributor
timestamp: March 20, 2023, 11:23:37 am
content: .

author: westfw
author_rank: Super Contributor
timestamp: March 22, 2023, 04:51:40 am
content: That's because it's stupid. You should be able to say "I have a 12MHz crystal and I want a 32MHz clock" and it should figure out all the mysterious parameters for you. :-( (But NO, vendors seem to universally want to show off the elegant complexity of their clock generator(s) by making you configure every little separate bit. Sigh.)

author: wek
author_rank: Frequent Contributor
timestamp: March 22, 2023, 05:58:18 am
content: Quote from: westfw on March 22, 2023, 04:51:40 amIf you want it dumb, get a dumb mcu. The new STM32C0xx family has no PLL. Want 32MHz clock? Go grab a 32MHz crystal.Beneath this clicky is a single call to HAL_RCC_OscConfig() function (maybe in some corner cases there are more, I don't Cube). You fill in a struct, mostly just telling "I have a 12MHz crystal and want a 32MHz clock" and call that function.At the end of the day, you just can simply read the fine manual and write five lines of program which set up the two registers which do all the work.JW

author: dietert1
author_rank: Super Contributor
timestamp: March 22, 2023, 07:29:59 am
content: Once the OP understands what is a clock MUX and how to configure a clock MUX in the CubeMX clock view, he can help himself. It's simple enough and CubeMX will tell you if one of the output clocks is out of range and it can resolve such issues all by itself.For a beginner understanding the STM32 clock generators to the point where he needs "some lines of code" can take a lot of time, even if born as "reader of manuals".Regards, Dieter

author: barshatriplee
author_rank: Regular Contributor
timestamp: March 28, 2023, 09:59:23 am
content: Did you post this question to the STM community? I think there you will get easier guidelines.
Assembler CH32V307x. - Page 1
Forum section: electronics / general

author: AVI-crak
author_rank: Regular Contributor
timestamp: March 06, 2023, 10:40:13 pm
content: Hello.I'm a little mocking CH32V307VCT6. The C code works without problems, but I want a lower level - assembler. And here is a complete failure. All my ARM developments turned out to be useless.First, I want to deal with the startup file startup_ch32v30x_D8C.s .The line "NMI_Handler: 1: j 1b" and below is of interest - I have not seen such a syntax, and I do not understand the purpose of the line.Code:......weak DMA2_Channel9_IRQHandler /* DMA2 Channel 9 */.weak DMA2_Channel10_IRQHandler /* DMA2 Channel 10 */.weak DMA2_Channel11_IRQHandler /* DMA2 Channel 11 */NMI_Handler: 1: j 1bHardFault_Handler: 1: j 1bEcall_M_Mode_Handler: 1: j 1bEcall_U_Mode_Handler: 1: j 1bBreak_Point_Handler: 1: j 1b.....

author: langwadt
author_rank: Super Contributor
timestamp: March 06, 2023, 11:03:11 pm
content: 1 minute of google; "J" is jump, "1b" is 1 backwards, so it is an infinite loop

author: brucehoult
author_rank: Super Contributor
timestamp: March 07, 2023, 01:29:30 am
content: This is absolutely standard GNU assembler on any platform, including ARM. "1b" for the nearest label 1 in a backwards direction, "1f" for the nearest label 1 in a forwards direction.And RISC-V uses "J" for the unconditional Jump instruction (short for JAL with return address discarded into register 0) vs ARM using B/BL for the same purpose (ARM originally of course could make any instruction conditional, so no distinction possible between conditional Branch and unconditional Jump).

author: AVI-crak
author_rank: Regular Contributor
timestamp: March 07, 2023, 08:38:25 am
content: It is clear - these are traps for a stupid code, literally.The standard GCC uses a more cunning thing - a name replacement. And this seems to me a more logical solution.Code:.weak NMI_Handler.thumb_set NMI_Handler,Default_Handler.weak HardFault_Handler.thumb_set HardFault_Handler,Default_Handler

author: brucehoult
author_rank: Super Contributor
timestamp: March 07, 2023, 09:05:41 am
content: Quote from: AVI-crak on March 07, 2023, 08:38:25 amIt's exactly the same. Look at the .weak definitions above.The difference is that this code has a different default handler for each trap type, not just the same one for all. So if your chip locks up and you connect with a debugger you can see WHICH loop it is stuck in and therefore which kind of trap that can't happen actually did happen and you should add a handler for it.At a cost of 2 bytes of code each.
Simple way to program M68HCS08 series - Page 1
Forum section: electronics / general

author: Circlotron
author_rank: Super Contributor
timestamp: March 19, 2019, 04:13:15 am
content: Making the move from HC908 to M68HCS08. Also first time for in system programming. Had a look at all this Code Warrior stuff and pods to go between PC and target board. I'm bamboozled by so many choices. All I want to do is download the .s19 file into the micro. No need for simulation or debugging or all that fancy stuff. Already have good HC908 code that just needs to be massaged a little because of different cycle count for some instructions. Where should I start? Doesn't have to be free, say up to several hundred dollars is okay.

author: Gribo
author_rank: Frequent Contributor
timestamp: March 21, 2019, 08:32:12 pm
content: Check PE micro. A bit expensive though.

author: DDunfield
author_rank: Regular Contributor
timestamp: March 22, 2019, 05:35:37 pm
content: I did a contract using M68HCS08 a while back, IIRC device was MC9S08QG8.For development we used CodeWarrior with PE micro universal multilink interface (part# on device is: USB-ML-UNIVERSAL).But if all you want to do is load the code, the BDC interface is fairly well documented under "Development Support".As part of the manufacturing test system, I implemented the BKGD 1-wire interface by "bit bashing" it on an STM32F103 (Blue Pill) for the purpose of loading firmware, and it worked quite well.(and much simpler and easier to automate than trying to do it through CodeWarrior and PE interface which of course "needs a windows-PC").Dave

author: jaromir
author_rank: Unknown
timestamp: March 29, 2019, 09:27:34 am
content: PE tools are classic for HC(S)08 MCUs.Just for sake of completeness, I'm using USBDM for flashing HCS08 MCUs and internal clock calibration. USBDM has both GUI and command-line tools, being helpful to both hardware testing/development and production programming.

author: Circlotron
author_rank: Super Contributor
timestamp: March 09, 2023, 12:09:18 am
content: Just an update on this one.Went and spent AUD$1000 on a PE Multilink thing and persisted with it for about 2-1/2 years. Worked sort of okay with S08PA micros but would lose the USB connection every single time you went to program. And would not get a BKGD connection with S08FL micros. After a lot of back and forth with their help guy I received and did a firmware update and that fixed the FL micro problem at least. Still had the USB dropout problem and so does a friend who bought the same programmer. Also I found the software tedious to use in a repetitive production environment. Although to be fair, I don't think that was what it was intended for.The upshot of all this was eventually got a $20 USBDM programmer and associated free software, the author of which is on this forum even, and haven't looked back. It is perfect for my needs. If only I had known ahead of time...

author: pgo
author_rank: Regular Contributor
timestamp: March 09, 2023, 02:47:09 am
content: USBDMhttps://sourceforge.net/projects/usbdm/but I'm biasedThey are still available on ebay etc.A little bit cheaper than a multilink.
MSP430 Wrist Watch Project - Page 1
Forum section: electronics / general

author: wd5gnr
author_rank: Regular Contributor
timestamp: July 10, 2010, 05:14:56 am
content: I know there was another thread on the $5 TI MSP430 board. But there's also the watch kit you can get for $25 or $50 dollars (depending on coupons). Here's my first project with the watch:Details athttp://www.drdobbs.com/blog/archives/2010/07/quick_ti_msp430.htmlSome of what I wrote athttp://www.drdobbs.com/blog/archives/2010/07/ez430chronos_an.htmlmight help you with the $5 board under Linux -- not sure since I haven't bought one (yet).

author: DiTBho
author_rank: Super Contributor
timestamp: March 02, 2023, 12:13:15 pm
content: Quoteis there a copy of the article?

author: I wanted a rude username
author_rank: Frequent Contributor
timestamp: March 02, 2023, 02:34:05 pm
content: Quote from: DiTBho on March 02, 2023, 12:13:15 pmAllow me to induct you into the mysteries of the Internet Archive:https://web.archive.org/web/20100724062932/http://www.drdobbs.com/blog/archives/2010/07/quick_ti_msp430.htmlThe other page is also in the Archive, but in both cases you need to select an earlier capture because Dr Dobb's deleted it some time in the early 2010s and later captures are of the 404 page.
Using ATTiny3217 curiosity board as a generic programmer - Page 1
Forum section: electronics / general

author: Greg J
author_rank: Regular Contributor
timestamp: March 01, 2023, 09:36:22 am
content: So I got myself a ATTiny3217 curiosity board - to give ATTiny another chance. Didn't have good experiences in the past trying to program the thing in-situ .I do wonder, since this includes "powerful" ARM processor that enables it to debug and program the little ATTiny3217 on the same board. Has anyone tried using the "curiosity board" as a programmer?I want to use ATTiny1616 for my design, and frankly having a proper and cheap programmer with debugging capabilities for my designs would be awesome.

author: Psi
author_rank: Super Contributor
timestamp: March 01, 2023, 09:44:22 am
content: Check out section 3.5 in the ATtiny3217 Curiosity Nano Hardware User Guide3.5 Programming External MicrocontrollersThe on-board debugger on ATtiny3217 Curiosity Nano can be used to program and debug microcontrollers onexternal hardware.Supported DevicesAll external AVR microcontrollers with the UPDI interface can be programmed and debugged with the on-boarddebugger with Atmel Studio.External SAM microcontrollers that have a Curiosity Nano Board can be programmed and debugged with the onboard debugger with Atmel Studio.ATtiny3217 Curiosity Nano can program and debug external ATtiny3217 microcontrollers with MPLAB X IDE

author: Greg J
author_rank: Regular Contributor
timestamp: March 01, 2023, 10:00:31 am
content: thank you, I missed that bit!
[STM32F407] System configuration controller clock question? - Page 1
Forum section: electronics / general

author: kgavionics
author_rank: Regular Contributor
timestamp: March 01, 2023, 04:33:57 pm
content: HelloAFAIK, the first step to configure external interrupts is to enable System configuration controller clock in the RCC APB2ENR register (bit 14), but to my surprise my external interrupts are working fine without enabling it!Can someone shed some light on this subject please?Thanks in advance

author: Siwastaja
author_rank: Super Contributor
timestamp: March 01, 2023, 05:01:32 pm
content: STM32 SYSCFG is a weird thing. It just seems some kind of catch-all name under which some random registers were put in absence of better placement.I'm not surprised at all that some of these registers seem to work without enabling the SYSCFG clock. It's probably something like the SYSCFG-located EXTI configuration registers being clocked from EXTI and not SYSCFG; i.e., maybe the registers are, after all, in one place, with rest of EXTI registers (EXTI_IMR etc.). If this is the case, it's beyond me why they are documented as being part of SYSCFG, but it would be typical ST. This is just a guess though.But don't count on it working reliably, or with every device.

author: kgavionics
author_rank: Regular Contributor
timestamp: March 01, 2023, 05:22:45 pm
content: Thank you for the clarification, Siwastaja!

author: wek
author_rank: Frequent Contributor
timestamp: March 01, 2023, 08:29:59 pm
content: > my external interruptsLet me guess: on PAx pins?JW

author: kgavionics
author_rank: Regular Contributor
timestamp: March 01, 2023, 08:39:12 pm
content: Quote from: wek on March 01, 2023, 08:29:59 pmyes!Is there something special with GPIOA pins?

author: wek
author_rank: Frequent Contributor
timestamp: March 01, 2023, 08:42:28 pm
content: They are selected by default in SYSCFG->EXTICRx, so you don't need to set anything in those registers.If SYSCLK does not have clock, it means you can't set those registers, but not that they "don't work" - these in particular are pure memory-like registers which hold the value they've written, and internally they drive the EXTI input multiplexers. They hold zero after reset, and that corresponds to PAx pins in the EXTI multiplexers.JW

author: kgavionics
author_rank: Regular Contributor
timestamp: March 01, 2023, 08:50:52 pm
content: Quote from: wek on March 01, 2023, 08:42:28 pmThank you Wek for this nice explanation! That makes sense now!
Entering (ISP) bootloader on GD32 (F350) - Page 1
Forum section: electronics / general

author: Saimoun
author_rank: Frequent Contributor
timestamp: December 22, 2022, 06:17:06 pm
content: HiI'd like to program a GD32 via the internal bootloader, by pulling the BOOT0 pin high.Has anyone tried this before? The only thing I could find is this old topic by blueskull:https://www.eevblog.com/forum/microcontrollers/gd32-unable-to-download-program/I'll use USART0 (since according to that link USART1 did not work). There is not much documentation about this from GD unfortunately.I plan to use a CH340N to do the USB <-> USART comm. All I need are the pins TX and RX connected on the MCU, right?(for reset, I'll just cut the power, connect BOOT0 to VCC, then put the power again so the pin is pulled high while it boots)ThanksSimon

author: Saimoun
author_rank: Frequent Contributor
timestamp: December 23, 2022, 03:28:59 pm
content: So Just FYI, I decided to use the setup shown in the CH340 datasheet, with the CH340X:http://www.wch-ic.com/search?q=CH340&t=downloads(section 7.9 at the bottom)

author: Saimoun
author_rank: Frequent Contributor
timestamp: March 01, 2023, 02:57:24 pm
content: Just updating this in case anyone wants to try: it worksI ended up using the CH340C at the end. GD provides this great "All in One programmer" that basically lets you choose how you want to use the RTS and DTR pins so it does not matter so much how you wire them.And I used USART0 (as mentioned in my first post it seems USART1 has had issues as per the blueskull post).See below my wiring. In the GD all in one programmer I chose "RTS high level reset, DTR low level into BL" and that works fineSimon
Advices for an EEPROM programmer - Page 1
Forum section: electronics / general

author: NiaDebesis
author_rank: Frequent Contributor
timestamp: February 27, 2023, 01:25:39 pm
content: I have to buy a programmer to burn some plcc eeproms (plcc package, 512k8) I was wonder if I have to check something in particolar and also if the adapters to dip from plcc are Universal for every programmer.I am sorry if this Is a neewbie questione, but Indeed I am
FT81x LVGL with STM32 - Page 1
Forum section: electronics / general

author: blindelectronics
author_rank: Newbie
timestamp: February 26, 2023, 12:26:21 pm
content: Does anybody know how to port FT81x to LVGL I am using STM32H7.I found this...https://gitlab.com/nucleo-f446ze-sandbox/f446ze-lvgl-test/-/blob/master/FT812/tft.cIt is way too difficult for my tasteSo I found this...https://github.com/controllerstech/STM32/blob/master/LVGL/Simple_F446/Core/Src/lcd_lvgl.cI just need to change command: fillFB(area->x1, y, area->x2, y, DISP_fb);with classic FT81x command. (using this official libraryhttps://github.com/MatrixOrbital/EVE2-Library)Thank you for help and ideas
Stop STM32 CubeMX init'ing DMA in the wrong place. - Page 1
Forum section: electronics / general

author: paulca
author_rank: Super Contributor
timestamp: February 24, 2023, 02:07:30 pm
content: It's a hack, but it works. As you can see it's already tried to screw up the ordering.Code:/* USER CODE BEGIN SysInit */// Force ordering as CubeMX will place DMA init after USART1if (1 == 1) {MX_GPIO_Init();MX_SAI1_Init();MX_SAI2_Init();MX_SAI3_Init();MX_DMA_Init();MX_USART1_UART_Init();MX_USART2_UART_Init();} else {/* USER CODE END SysInit *//* Initialize all configured peripherals */MX_GPIO_Init();MX_SAI1_Init();MX_SAI2_Init();MX_SAI3_Init();MX_USART1_UART_Init();MX_DMA_Init();MX_USART2_UART_Init();/* USER CODE BEGIN 2 */}

author: wek
author_rank: Frequent Contributor
timestamp: February 24, 2023, 05:33:19 pm
content: This workaroundappears to indicate that it's enough to enable the DMA clock.NewestSTM32CubeMX 6.7.0changelog contains this, maybe related, line in the "fixed issues" list:130537 [Project Manager] Wrong call order for MDMA/DMA Init functionsAFAIK, the ordering is stored in .ioc, so even if you install new CubeMX it won't fix old .ioc's ordering; but you can reorder simply by editing the .ioc, that's theofficial fix.I don't CubeMX, just listen the cries throughout those years.JW

author: paulca
author_rank: Super Contributor
timestamp: February 24, 2023, 07:28:18 pm
content: I recall similar issues with I2S and external clocks and I solved part of that by forcing calling the clock enable/set macro before and again after, the HAL Init.The trouble there was (F4 firmware/hal) they missed a bit value comparison and were using the raw bit value like 32, 64, 128 in a comparison between config int 0, 1, 2. if( REGISTER&BitPos == 1). To this day I have to edit that RCCEx function. I should find a better way, but it's not impacting my currently as I'm off the I2s and onto SAIs which suffer not.
How to overclock a Kinetis MK64 - Page 1
Forum section: electronics / general

author: luiHS
author_rank: Frequent Contributor
timestamp: February 27, 2023, 09:35:33 pm
content: Hello.Does anyone know how to overclock a Kinetis MK64 to make it run at 180Mhz? It would be using MCUXpresso.I already did this with Teensy 3.5 that uses the same microcontroller, but in that case it appears as an option in the Teensy 3.5 configuration menu on Arduino.I don't know how it could be done in MCUXpresso, the config Tools don't allow it, I suppose I'll have to manually modify the source code where the clock PLLs are configured.
Why bit shift *and* mask to set bits? - Page 1
Forum section: electronics / general

author: knotlogic
author_rank: Regular Contributor
timestamp: February 22, 2023, 01:02:33 pm
content: I've been poking through some of NXP's SDK for their Cortex M processors, and I've come across a pattern in their code where I think I understand what they're doing, but not why.If they want to configure TARGETREG with only bits THISBIT and THATBIT set, they do this:Code:#define SETTHISBITMACRO(x) (((uint32_t)(((uint32_t)(x)) << THISSHIFT)) & THISMASK)#define SETTHATBITMACRO(x) (((uint32_t)(((uint32_t)(x)) << THATSHIFT)) & THATMASK)uint32_t config = 0U;config |= SETTHISBITMACRO(1U);config |= SETTHATBITMACRO(1U);TARGETREG = config;The SHIFT and MASK values are always defined to have MASK = 2^SHIFT, matching the bit to be set. The "shift and OR" is the regular way of setting bits, but why the need to do the AND with the mask? My understanding is it has no effect, given 1u shifted left SHIFT number of bits would have the value of MASK anyway. Is there something I'm missing here?

author: Kalvin
author_rank: Super Contributor
timestamp: February 22, 2023, 01:09:36 pm
content: Mask will reduce the effect of supplying a value outside the valid range.For example this will set the bit to "1", but will not affect the other bits:config |= SETTHISBITMACRO(9U);For example this will not change the bit state, but will not affect other bits either:config |= SETTHISBITMACRO(8U);

author: knotlogic
author_rank: Regular Contributor
timestamp: February 22, 2023, 02:41:58 pm
content: Thank you! On hindsight it now seems so obvious, especially since I came across a variant of the macro where they set bits 4-7 with a user value and mask against 0xF0.

author: darkspr1te
author_rank: Frequent Contributor
timestamp: February 22, 2023, 04:21:25 pm
content: In MCU's we use the bit set/mask to toggle IO and depending on compiler can reduce the cycles needed for operations, without it we would have to read the register, work on the bit we wanted in memory and then write the value , this would tie up that group of gpio for a lot longer.A use case would be generating a clock signal on one pin but the others act as input and output for clocked uart(or bus), another use is 8bit spi data where you use a additional 9th bit as a command/data toggle for the spi(serial) to parallel converter , software is used here often as HW spi generally only support 8 bit or 16 bit transfer so the additional bits would cause bus noise to the parallel bus on the end so end result is a 9bit software serial SPI using bit shifting & masks to improve speed.There are mcu's & maybe even cpus without mmu's that are out there that dont support direct masking too and it's provided by a compiler software routine, this issue bit me once fiddling with a Chinese made chip & compiler system provided by OEM, i didnt know at the time the gcc they used had items patched to point to software routines and not what we would normally see as one(sic) arm instruction via a accepted (offical) gcc compiler.am no expert, just a self taught fiddler so other may have better answers.darkspr1te
OpenPLC good bad or ugly and does it have a place over other options? - Page 1
Forum section: electronics / general

author: beanflying
author_rank: Super Contributor
timestamp: February 23, 2023, 10:19:50 am
content: I ran across this project a few years ago and never really kept up but today it popped up again in my YouTube feed while looking for modbus ones.Not sure if there is a thread here for it but I have had a fairly good search natively and with Google but found Crickets and a few mentions years ago.Anyone had a recent play or are using it regularly?https://openplcproject.com/
Mounriver - User interface problem - Page 1
Forum section: electronics / general

author: Gawron
author_rank: Newbie
timestamp: February 22, 2023, 02:24:40 pm
content: Hello!I have just started my adventure with CH32V003.Currently I am exploring examples for this uC and noticed that there are missing some characters in editor.For example in statementCode:GPIO_InitStructurethe "_" appears as " ".It WILL cause problems in future. Do you know how to fix this?Thank You!

author: Gawron
author_rank: Newbie
timestamp: February 22, 2023, 02:51:18 pm
content: Ok, problem solved.Just choosen another theme from Window->Preferences->General->AppearanceMounRiver Dark theme seems to be broken.EDIT:Nope, that was not that.I had to increase font size.Window->Preferences->General->Appearance->Colors and Fonts->C/C++->Editor->Editor Text Font->Edit...
MounRiver Studio - peripheral registers - Page 1
Forum section: electronics / general

author: uliano
author_rank: Regular Contributor
timestamp: February 21, 2023, 11:14:26 am
content: When debugging an example download from herehttps://github.com/openwch/ch32v003the "Peripherals" view doesn't show anything at difference with my expectation.Expectation reinforced by finding CH32V003xx.svd well buried into MounRiver_Sudio/template/wizard/WCH/RISC-V/CH32V003.Has anyone found a way to look into peripheral registers?

author: uliano
author_rank: Regular Contributor
timestamp: February 21, 2023, 01:38:22 pm
content: I just found out that if I create a new project (rather than opening one of the github examples) the .svd with peripheral description gets loaded and I can see all register.

author: uliano
author_rank: Regular Contributor
timestamp: February 22, 2023, 07:00:33 am
content: The answer was pretty simple (once you know where to look), also people on github are pretty reacvtive.I found the file path configured exactly as in the picture, possibly eclipse (ahem mounriver) was expecting to find the demo code inside its workspace but I downloaded it elsewhere.I just browsed to the .svd
Oops: Bricked NXP CPUs - Page 1
Forum section: electronics / general

author: AussieBruce
author_rank: Regular Contributor
timestamp: February 22, 2023, 01:12:20 am
content: I have inadvertently bricked (I suspect) a couple of boards containing an NXP LPC2138 CPU. I access them by connecting a Segger JTAG directly to the JTAG pins on the chip, the PINSEL2 register controls whether the JTAG pins are configured for debug (JTAG) or for GPIO. Inadvertently, my code set this register to zero, which sets them to GPIO. Working through RAM this wasn’t a problem, because if I powered down the chip the loaded coded disappeared, and when the chip came back up the JTAG connection was there because default startup setting is JTAG. However, I made the mistake of burning my program to NVR, and it appears that as soon as the chip powers up the code takes over and disables JTAG connectivity. I’ve tried 2 means of connecting through JTAG, neither of them works.The chip manual states that it is possible to force the mode to JTAG by pulling a particular chip I/O line low (P1.26). However, on this board that pin is not brought out in an accessible way.I suspect the bricking is permanent, does anyone have any suggestions?

author: langwadt
author_rank: Super Contributor
timestamp: February 22, 2023, 01:21:37 am
content: as I read the datasheet pulling P0.14 low before boot should enter the bootloader with jtag as long as you haven't set any code protection options

author: nctnico
author_rank: Super Contributor
timestamp: February 22, 2023, 06:15:08 am
content: Quote from: AussieBruce on February 22, 2023, 01:12:20 amYou can always use the serial port bootloader to erase the entire device which resets the security bits as well. Flashmagic is a good software tool for this purpose. Unless you used a BGA package OR connected the 'bootloader entry' pin to the supply voltage, you can solder a wire to the pin and pull it low during boot to enter the bootloader.
[STM32] MPU9250's magnetometer not updating data - Page 1
Forum section: electronics / general

author: SpareFag
author_rank: Contributor
timestamp: February 19, 2023, 04:25:05 pm
content: Hello.I'm having issues reading magnetometer readings using SPI on a STM32. When using continuous mode 2, data shown is constant. I followed the reading procedure on the AK8963 datasheet. I initialized as follows:- Power down mode- wait- Fuse mode- Wait- Read sensitivity adjustment values- Power down- Wait- Go to continuous mode 2It seems to work as the value 0x16 (the one I set) is always present when I read the CTL1 register.When reading the magnetometer in the main loop, I follow this procedure: read status one -> check for ready bit -> if ready then read measurements + status 2 -> check status 2 for overflow -> if no overflow then save the measurement.Here is the code for reading magnetometer:Code:/*** MAGNETOMETER ***/uint8_t cmd = 0x80|reg, ready, magdata;uint8_t data;cmd = (MAG_STATUS_1|0x80);HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_RESET);HAL_SPI_Transmit(hspi, &cmd, 1, 100);HAL_SPI_Receive(hspi, &ready, sizeof(ready), 100);HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_SET);if ((ready & 0x01) == 1) {cmd = (MAG_DATA|0x80);HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_RESET);HAL_SPI_Transmit(hspi, &cmd, 1, 100);HAL_SPI_Receive(hspi, magdata, sizeof(magdata), 100);HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_SET);uint8_t status = magdata;if ((status & 0x8) == 0) {imu->magneto.x = (float)(((int16_t)magdata<<8) | magdata);imu->magneto.y = (float)(((int16_t)magdata<<8) | magdata);imu->magneto.z = (float)(((int16_t)magdata<<8) | magdata);}}the "imu" is a struct I made. It works fine when reading accelerometer and gyro data. Magnetometer readings are the same no matter the position in which I put the device: 42215.0; 5409.0; 6060.0.Could anyone help me see my mistake?

author: SpareFag
author_rank: Contributor
timestamp: February 20, 2023, 06:22:28 pm
content: Small update: I was just checking the WHOAMI's of th MPU and the AK. The AK returned 0xC5, which is obviously wrong, but what's uncanny is that the MPU returned 0x75 instead of 0x71. I have no problem reading the accel and gyro values, and they seem correct (I even simulated the rotation of a 3D rectangle using the raw gyro values and the values seem logical).Anyway, could anyone explain to me this weird situation, please?

author: SpareFag
author_rank: Contributor
timestamp: February 20, 2023, 06:37:43 pm
content: My bad, I meant 0x75 instead of 0x71. I edited the previous message.

author: SpareFag
author_rank: Contributor
timestamp: February 20, 2023, 06:44:30 pm
content: It would be quite troublesome...Still doesn't explain the weird output when I read the data registers.
[MSP430]  Modified BSL-Scripter for Windows now works with USB-to-UART adapters - Page 1
Forum section: electronics / general

author: Peabody
author_rank: Super Contributor
timestamp: March 22, 2019, 05:29:13 pm
content: A new WIN32 version of BSL-Scripter.exe has been compiled which allows BSL flashing using generic USB-to-UART adapters such as the FT232, CP2102 and CH430 as the hardware interface. It can be used with MSP430 F5xx F6xx, and FRxx parts with UART BSL.This version has a new MODE line option "INVOKE", which causes Scripter to directly generate the BSL hardware invocation sequence on the adapter's DTR and RTS outputs, which in turn are connected to the /Reset and Test pins on the target device. It produces the pattern shown in Figure 2 of slau319w.pdf and slau550s.pdf, which is normally generated by the Rocket or MSP-FET. If the INVOKE option is used, you must include the PARITY option as well.I have successfully tested the new Scripter on an MSP430FR2311 using all three adapter types. It would be helpful if others could test other relevant MSP430 parts and report the results.This has finally come about as a result of the generous efforts of "drcrane" on Github, who not only got TI's source code to compile with new versions of all the dependencies, but also navigated the mysteries of BOOST to control the DTR and RTS lines. The new Scripter and a related Instructions file are contained in "BSL-Scripter-v3.4.1.zip" in the Releases folder of his repository, which also contains the source code:https://github.com/drcrane/bslscripter-vs2017/releasesFor those who must run an official TI version of Scripter, I will leave on my Github the now-deprecated kludge option for using these adapters with the official Scripter, but of course it requires either manual intervention or an additional circuit:https://github.com/gbhug5a/CP2102-with-BSL-Scripter-for-MSP430And finally, a reminder that the older MSP430 parts which use BSLDEMO2 for flashing, including the F1xx, F2xx, F4xx, and G2xx parts with BSL, can also be flashed with these adapters if a modified version of BSLDEMO is used, such as the "BSLDEMO-2.01C.exe" found in my other repo:https://github.com/gbhug5a/MSP430-BSLTexas Instruments has neither reviewed nor approved any of this. But I continue to hope TI will officially make similar changes to BSL-Scripter and BSLDEMO to support the use of these generic adapters.

author: hucode
author_rank: Newbie
timestamp: February 22, 2023, 10:02:59 am
content: hello！I look your page。download but don‘t use “MSP430G-BSL-Using-Embedded-Adapter” this file open error。do you mail to me？Thank you。你好，我查看到你发的文章，根据连接下载后发现 “MSP430G-BSL-Using-Embedded-Adapter” 这个文件损坏。导致我不知道如何使用 脚本的额外功能，就是DTS和RTS脚的设置方式。使用默认方式无法产生相应的波形。目前我在对msp430F5525进行串口 BSL 编程，我手上的芯片usb bsl被修改了。如果可以请 mail ：hucode@163.com 对于这个bsl方式如果有更好的推进也希望能够教一下，先谢谢啦！
Raspberry Pi Pico as USB to UART/I2C/SPI converter - Page 1
Forum section: electronics / general

author: NiHaoMike
author_rank: Super Contributor
timestamp: February 14, 2023, 04:20:46 am
content: What project is most recommended for using a Raspberry Pi Pico as sort of like an enhanced Bus Pirate? Use case is to plug the Pico into a PC and then write Python scripts on the PC to easily play around with various devices. Ideally, the UART should work just like any other USB UART while the SPI and I2C should make use of Python libraries. (Obviously, it won't be useful for very timing sensitive applications.)

author: DC1MC
author_rank: Super Contributor
timestamp: February 14, 2023, 05:04:55 am
content: Like this project:https://hackaday.com/2021/04/18/bridging-the-pc-and-embedded-worlds-with-pico-and-python/

author: SiliconWizard
author_rank: Super Contributor
timestamp: February 14, 2023, 07:13:01 pm
content: Ask ChatGPT?

author: newbrain
author_rank: Super Contributor
timestamp: February 17, 2023, 08:52:14 am
content: I have written asimple one-afternoon hacked togetherthing I use as a Teensy programming helper.Dual USB<->UART, some I/O (piggybacked on baud rate changes).Need of course some work, but might be a start.Adding SPI/I2C could be done by adding a HID device and using a dedicated application PC/Mac side.Or some kind of shell through UART could be implemented...

author: DC1MC
author_rank: Super Contributor
timestamp: February 17, 2023, 09:08:44 am
content: Well, strangely enough, the embedded part is not where the most work is, the most work seem to be done on the host "driver" side, the Linux versions try to emulate the I/O expanders drivers, as well as native I2C and SPI controllers. This approach has pros and cons, but, if I remember correctly, the OP didn't care about this, if the thing enumerates as a standard USB serial port (ACM) and a message structure is defined to select in between supported peripherals, than it can be used via some library, that way easier to port between OSes as opposed with a device driver.Cheers,DC1MC

author: TomKatt
author_rank: Frequent Contributor
timestamp: February 17, 2023, 11:35:09 am
content: Quote from: DC1MC on February 17, 2023, 09:08:44 amI've done something similar using an AVR when I just needed to send some I2C or SPI commands to a board for testing. The AVR is seen as a serial UART device by the pc, and a few custom commands would trigger the appropriate I2C or SPI output from the AVR. In that scenario, you could simply open a serial terminal like PuTTY and send command strings that pass the data along as desired.
ESP32-C3FH4 not getting detected by PC (Crystal problem?) - Page 1
Forum section: electronics / general

author: ollieelliot
author_rank: Newbie
timestamp: February 12, 2023, 08:22:01 pm
content: Hello everyone!I have a custom ESP32-C3FH4 board derived from the reference manual, it has all the necessary decoupling capacitors and inductors for VDD. I've measured 3.3V on VDD going to all power pins on the ESP32. My USB is connected to the ESP32 as well (I use the internal USB/JTAG converter) but my PC won't detect a USB device when I plug it into my PC. I've started to suspect something is wrong with the crystal so I measured it with an oscilloscope (probe 10x, <12pF) and it is a clipped signal, not a sinus (see link). The frequency is at about 10Khz, but the crystal should be at 40Mhz (10ppm, CL = 8pF). D+ and D- are connected to GPIO19 and GPIO18, respectively. I tried changing the crystal and the MCU but still doesn't work and I have very strong transients on my clock signal (see link).I'm assuming the strapping pins won't matter to just get a COM port detected by my PC. Currently GPIO9 = LOW, GPIO8 = HIGH and GPIO2 = HIGH. I have tried both bootstrapping modes.I have attached pictures of my PCB for the ESP32 (zoomed in on parts, for better pin name clarity).The link to the schematic PDF is here:https://schematic.tiiny.site/(3 pages)Link to PCB layout and oscilloscope measurements:https://imgur.com/a/LW2uZdgI've posted this question to the espressif support forums and on Reddit and basically got the response "no clue". Right now I'm really frustrated and clueless as to what the problem is. I've spent many hours troubleshooting and looking through my schematic and comparing. I have seen other people doing projects with the C3FH4 and using the built-in USB/JTAG converter as well as no buttons on the strapping pins, and they get it to work. I have compared my schematic to theirs and I really have no clue.All tips would be much appreciated!Edit: I've used flux when soldering and have tried cleaning up as much residue as possible. Could it cause problems with the crystal?

author: thm_w
author_rank: Super Contributor
timestamp: February 16, 2023, 11:28:51 pm
content: https://www.reddit.com/r/esp32/comments/10yrnh4/esp32c3fh4_not_getting_detected_by_pc/https://www.esp32.com/viewtopic.php?f=12&p=109216https://cdn-learn.adafruit.com/assets/assets/000/109/793/original/adafruit_products_QTC3_sch.png?1647545127Did you solder the crystal backwards?Photo of soldering?
Clock - attiny85 - Thanks! - Page 1
Forum section: electronics / general

author: ehud42
author_rank: Newbie
timestamp: February 11, 2023, 07:29:37 pm
content: I poked at with a question about driving a coil direct from an ATTiny85.https://www.eevblog.com/forum/microcontrollers/driving-latching-relay-with-attiny85/Well, thanks to the advice, the project is basically finished. It's a clock.https://www.flickr.com/photos/flyinglow/albums/72177720305936037A couple "hacks" / clever bits:I/O pins on a DigiSpark are 0.1" spaced. Using Pins 0 & 2 enables me to direct solder a screw terminal to the spark for connections to the coil.The function to toggle the stepper is then simplified:Code:void Pulse() {static int p = 0;digitalWrite(2*p, HIGH);delay(32);digitalWrite(2*p, LOW);p = !p; // Toggle}To get the minute hand to take 1 full year to go around, I was aiming for 1 "tick" every 8,760 seconds. I experimented a bit with the ATTiny's sleep function, and after a bit of tweaking the loop timer, I got the second hand ticking once ever 8,765 seconds (average over 48 hours). Which turns out to take the minute hand 365.22 days to complete a loop. I'm "Leaping" for joy :-)Running the clock backwards just requires the physical bar in the coil to be flipped over. This simultaneously fascinates and disturbs me. Electromagnetism is weird.Based on some guidance from the above thread, and some tests with an oscilloscope, I added a couple 3.3v Zeners (3.3V were 1/2 the price of 3V at my local store) from each leg of the coil to ground.Code:+--mmmm--+| |+->Z-+ +-Z<-+| | | || P0 P2 || |+--------+---------+|GNDPowered by an 18650 battery USB thing that provides 3.3V in addition to 5V. Plugged in for continuous operation with battery backup.
Using a 2.8in SPI LCD Touchscreen ILI9341 with an ESP32 on Platformio - Page 1
Forum section: electronics / general

author: jcrubin
author_rank: Frequent Contributor
timestamp: February 11, 2023, 02:52:33 am
content: Today well be interfacing the 2.8 inch SPI LCD Touchscreen with the ILI9341 chipset to an ESP32 using the current release of Platformio, taking advantage of both display and touchscreen features, though well skip the SD card as its just an addon to the board not directly connected to these systems. I have a separate video for SD card interfacing. Out setup will not be powered through the ESP32 so I'm setting up an HW-131, a well known cheap DC power supply for this task.First I'll make sure that TDT_ESPI library is installed into this example project. Ive updated platformio.ini to set the monitor speed.Following library installation, within the project pio and libdeps folder some library configurations will be made in support of out device. In particular, setup 42 will be addressed in a few files. Once these changes are made the physical wiring will be made between the two devices as demonstrated in the video.In PlatformIO, I first attempt an easy example, copying from examples into the source folder from under the 320x240 sub folder to ensure correct operation and wiring of the device, the example is working correctly. Following this, a touchscreen example is loaded for testing, we can see that it does not compile, but I show why Arduino IDE examples do not always work out of the box, once modified for platformio, it proves to also work correctly, completing this demonstration.
STM32 Ethernet Problem  - Page 1
Forum section: electronics / general

author: flowchartx
author_rank: Newbie
timestamp: February 07, 2023, 06:37:41 am
content: Good work everyone,I am communicating with the STM32F746 processor using the lwip library. I got the ethernet buffers in the special area of ​​the RAM and protected it with the MPU. Then I disabled the buffering feature. My code works as I want, but after 10-15 minutes communication is cut off. My grounding, my connections, everything looks good.

author: paulca
author_rank: Super Contributor
timestamp: February 09, 2023, 12:49:29 pm
content: Run it in the debugger. Wait for it to fail. Pause the execution and see where it's stuck. Often you'll find it in an error handler loop.Another common gotcha is forgetting to implement the Error call backs for peripherals. If you are triggering on interrupts and an error occurs, the peripheral will stop. You will need to recover and start it back up again in the Error callback.In the debugger, sanity test things, make sure you are writing to the area you expect and you haven't used Byte length instead of word length.

author: peter-h
author_rank: Super Contributor
timestamp: February 09, 2023, 01:26:33 pm
content: MPU? Is this a multi processor system?I recall some posts on the ST forums about getting stuff to work. Seems very difficult, with various hacks like __DSB being needed.I've spent months of my life getting a 32F417 working reliably with LWIPhttps://www.eevblog.com/forum/microcontrollers/anyone-here-familiar-with-lwip/

author: flowchartx
author_rank: Newbie
timestamp: February 09, 2023, 02:19:20 pm
content: Thank you for answers.First of all, I debug. and communication is lost but I didn't get any error message then I close MPU, D-Cache, I-Cache.Now, i trying all day. I didn't encounter any breakouts so it seems to be fixedI wonder why this is so?My system is not multi-processor

author: eutectique
author_rank: Frequent Contributor
timestamp: February 09, 2023, 03:21:19 pm
content: Quote from: peter-h on February 09, 2023, 01:26:33 pmMemory Protection Unit
tsum058cdt9-8 pinout - Page 1
Forum section: electronics / general

author: Tony.T
author_rank: Regular Contributor
timestamp: February 09, 2023, 10:51:36 am
content: I have a circuitboard from a Dell Monitor SE2416Hhttps://www.ebay.com/itm/263828211518Everytime it has been turned on for a while it starts to shut down and on automatically. if i use a hot gun on some areas it turns off DIRECTLY. (bottom right area on the picture from the link above).i have tried to measure the changes in that area when it turns off but cant see anything odd. it is hard to only warm up a very small area and as i said, the board turns off and on also without having to much heat on it. During normal usage . Only when powering it up it takes maybe one minute or two until the problem starts. it turns off and on every maybe 30-60 seconds. If i warm up the mcu itself it will turn off and on but it is hard to say if it is the mcu or some other components.i measured the ps on/off connector and DIM. on the connector top left. two lowest pins. And can clearly see that dim clock stops before the shotdown. THen on off pin goes low aswell. After 10 seconds the clock (dim) starts again and monitor turns on again. Those leads go to the MCU tsum058cdt9-8I can not find any pinout of this MCU to see what part of the circuitboard has this overtemp protection circuit. Is in built in and the only right thing is to change the MCU or is it another part of the circuit that somehow is involved and that needs to be replaced.The PS works good and all the voltages are present. And as i said....o can change the frequency of the turning off and on by heating it. Does not matter if it turns on after its shutdown...as soon i put the heatgun...it shuts off. (normally it does that again after 30-60 seconds but if only 2 seconds and putting the heatgun it shuts down)Any ideas here? Any help? Would be appreciated a lot.
Does HVAC gear use generic micros, or custom chips - Page 1
Forum section: electronics / general

author: e100
author_rank: Frequent Contributor
timestamp: February 06, 2023, 05:12:45 am
content: For stuff like thishttps://youtu.be/_iPxdmu4LCI?t=222It's soft of like a specialized PLC so I'm not sure where it sits in the microcontroller tree of life.

author: james_s
author_rank: Super Contributor
timestamp: February 06, 2023, 05:44:44 am
content: The most recent furnace I installed had a PIC, I don't know what fancy commercial stuff like the one in that video have but I'd say it is almost certainly an off the shelf microcontroller such as a PIC, AVR or STM32.

author: SeanB
author_rank: Super Contributor
timestamp: February 06, 2023, 10:05:14 am
content: Most use common parts, either regular microcontrollers with on board flash, or for the cheaper older parts in an OTP package, with built in EPROM and no erase window, programmed on a programmer before placing on the board. Generic firmware for a brand, then with a cheap EEPROM chip on the board that has option bits, so you can have different models with the same control board, so you can have a heat pump, cooling only, or any mix of them, and even fancy ones with a separate inverter board outside, communicating over a serial link. all on the same board, just populated with different components as needed.Once you get into the commercial world you get more sophisticated microcontrollers, but again they stick with the same families of microcontroller, just sometimes with more communications abilities, and with often the ability to expand using other off the shelf parts, like wireless gateways and such, that interface to the microcontroller. Yes it might not be a microcontroller you know, as often the base inside is a derivative of the 8051, complete with a whole host of peripherals, used because the actual IP of the chip is now free, the IDE is free, and it is available from a few fabs with the same pinout, firmware and speeds, and for AC use you really only need the slowest processor. Order 100k parts per quarter kind of manufacture, and all come pre programmed with the particular manufacturer firmware, and a pre programmed option set in EEPROM chip as well.I know Samsung has used the exact same microcontroller for 2 decades now, just a few board respins, in that they went from having a separate iron core transformer in the case, to a small built in SMPS, with the board being identical both firmware, mounting and use wise, just you remove the transformer. or leave it disconnected in the case, as the sockets are not there any more. Case moulds still have the space for it, and the mounting bosses, but no transformer in there. Set up the option bits for the new board with the remote control, and press power off on it, and power on, and it now works perfectly.

author: Ground_Loop
author_rank: Frequent Contributor
timestamp: February 07, 2023, 01:16:27 am
content: My heat pumps have PIC micros in both compressor and air handler. The Thermostats I don't recall, but they are digital with LCD graphic displays.