hybridfree/eevblog-posts huggingface dataset:
32F4 USB CDC - any way to tell if Host has retrieved the data sent to it? - Page 1
Forum section: electronics / general

author: peter-h
author_rank: Super Contributor
timestamp: September 04, 2022, 07:22:09 pm
content: The Cube IDE transmit (target -> PC) code flow isCDC_Transmit_FSUSBD_CDC_TransmitPacketUSBD_LL_TransmitHAL_PCD_EP_TransmitUSB_WritePacketand the last one does 16 32 bit word transfers to the USB FIFOCode:HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len, uint8_t dma){uint32_t USBx_BASE = (uint32_t)USBx;uint32_t *pSrc = (uint32_t *)src;uint32_t count32b, i;if (dma == 0U){count32b = ((uint32_t)len + 3U) / 4U;for (i = 0U; i < count32b; i++){USBx_DFIFO((uint32_t)ch_ep_num) = *((__packed uint32_t *)pSrc);pSrc++;}}return HAL_OK;}My Q is whether there is any way to tell when that data has been consumed by Windows.I have been doing tests and found- there is a ~10kHz rate limit on calling CDC_Transmit_FS- the max CDC_Transmit_FS packet size is 800 bytesI am sure these are both system dependent, so I am rate limiting to 1kHz and size limiting (splitting up longer packets) to 256 bytes. The data rate is pretty impressive; you can easily do 256kbytes/sec this way, and one could go much faster if something at the Windows end was acking the packets. And this is VCP, not MSC which is used for removable storage devices.There are various return codes from various functions but none of these appear to relate to whether you can shove more data out.Is USB really "open loop" like that? I know it is all polled by the PC, seemingly at ~10kHz.

author: peter-h
author_rank: Super Contributor
timestamp: September 05, 2022, 12:03:47 pm
content: This has been solved.I think flow control was unimplemented in the original Cube MX generated code. I did it with the method shown herehttps://community.st.com/s/question/0D53W00001mfognSAA/32f4-usb-cdc-any-way-to-tell-if-host-has-retrieved-the-data-sent-to-it?t=1662361131149Probably people don't implement it because USB is fast enough for issues to not get spotted. However, a 168MHz CPU will easily exceed a 10kHz packet rate.Also the ST HAL functions tend to return all kinds of error codes, which are often useless because one can't do anything with them. In this case, the caller was supposed to retry the packet transmit if it got USBD_BUSY, but it wasn't implemented properly by the next layer up.
Popular Electronics magazine projects - Page 1
Forum section: electronics / general

author: dgminala
author_rank: Contributor
timestamp: August 28, 2022, 01:57:14 pm
content: Back in the early days of microcontrollers, Popular Electronics magazine and its successors published a number of construction projects, many of them containing microcontrollers such as the PIC, the 805x, and other types. They posted the code for these projects on the Gernsback BBS (Bulletin Board Systm), the dial-up modem predesessor of the internet.I've been going back through some of my old issues, and have found a few projects that I'd like to build. However, I can't find any place on the web that contains an archive of the old BBS repository. I've searched through the Wayback Machine on the Internet Archive web site with no luck. It appears that the contents of the BBS was migrated to the Popular Electronics FTP server, but the Archive didn't capture any of the contents, and there doesn't seem to be any reference as to where those files might have migrated.Does anyone know of a site that might have those project files archived? If so, I (and probably a bunch of other folks) would certainly love to know about it.Thanks for any help,DaveM

author: rooppoorali
author_rank: Regular Contributor
timestamp: August 30, 2022, 08:08:46 am
content: I don't think those projects are archived anywhere. Nothing helpful appears in google search.

author: Ground_Loop
author_rank: Frequent Contributor
timestamp: September 04, 2022, 05:06:06 pm
content: FWIW Elementary Electronics is available on line.https://worldradiohistory.com/Archive-Elementary-Electronics/1970/Elementary-Electronics-1979-01-02.pdf

author: Dundarave
author_rank: Regular Contributor
timestamp: September 04, 2022, 05:43:01 pm
content: https://worldradiohistory.com/Popular-Electronics-Guide.htmThe worldradiohistory.com site is a fantastic resource for all manner of electro-technical periodicals from decades past. I love simply picking old ones at random to “flip” through.I just happen to be flipping through the Popular Electronics of the 1960s these days and I saw your post.

author: Ground_Loop
author_rank: Frequent Contributor
timestamp: September 05, 2022, 03:27:39 am
content: I can remember as a kid lusting for a 5MHz scope from Heathkit that were always advertised in those mags right next to the 'learn to repair TVs' ads.

author: rooppoorali
author_rank: Regular Contributor
timestamp: September 05, 2022, 10:47:51 am
content: Wow! Thanks for all these useful links, everyone.
Pulse Counter in STM32 - Page 1
Forum section: electronics / general

author: Md_Aslam
author_rank: Contributor
timestamp: September 01, 2022, 08:38:50 am
content: I am using the STM32 Nucleo-073RZ board to count the number of pulses provided on one of the GPIO pins of the STM32. I searched on the internet and found that using the Timer/Counter of STM32 will do this work but there is one problem, that is, I need to count pulses continuously say for 10 days and as my signal is of 10KHz so in 1 second STM32 will have 10000 values but timer available in the mentioned board is only 16-bit(65535). Hence I need two help:1) How to start working with Timer/Counter for external pulses in STM322) How to count millions of pulses with 16-bit available Timer/Counter in STM32Quick help would be highly appreciated

author: janoc
author_rank: Super Contributor
timestamp: September 01, 2022, 10:54:09 am
content: Quote from: Md_Aslam on September 01, 2022, 08:38:50 amIt is quite well explained in the datasheet/reference guide for the chip.Quote from: Md_Aslam on September 01, 2022, 08:38:50 amYou can daisy-chain multiple counters on STM32 (depends on which counter and which chip - check the doc!). You can also always have an interrupt triggered on overflow where you advance your own in-memory counter, which can be as wide as you want. A 32bit variable + 16 bit hw counter will give you a 48bit counter - at 10kHz good for almost 900 years before it overflows.16bit hardware counter and 10kHz signal that gives you one interrupt per 6.5 seconds or so, any microcontroller should be able to handle that with no issues.This is completely bog standard approach on every MCU.

author: Md_Aslam
author_rank: Contributor
timestamp: September 05, 2022, 07:45:38 am
content: Quote from: janoc on September 01, 2022, 10:54:09 amI got the first answer.But I have little doubt in the second answerAs you said with a 32-bit variable and 16-bit counter I can achieve the 48-bit variable/counter, but there is no datatype in STM32 that can hold a variable value more than 32-bit so how I will be able to store it in some variable and say transfer with UART protocol to the PC.PS: As far as I know max limit of datatype in stm32 is 32-bit, correct me if I am wrong.

author: janoc
author_rank: Super Contributor
timestamp: September 05, 2022, 08:53:32 am
content: Quote from: Md_Aslam on September 05, 2022, 07:45:38 amThat is both wrong - and completely irrelevant.You have the (u)int64_t type. That the CPU is 32 bit only means that the compiler will emit some library functions if you try to do some arithmetic with wider numbers (don't remember whether Cortex M has native 64bit instructions or not).And it is irrelevant because you can always keep those 16 bits of the count stored inside of the timer/counter register. In the worst case you can always implement the necessary support yourself - arbitrary precision arithmetic is a thing.This is pretty basic computer science stuff, IMO.
Making project from Keil for STM32H would fail - Page 1
Forum section: electronics / general

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: September 01, 2022, 01:23:08 pm
content: Hi,I want to make a simple project for STM32H750XB part, from keil, I mean using cubeMX button inside keil,I'm using basically the most recent and updated files,But the project would fail with lot's of error and warnings, Do you have any Idea what's wrong? the project is attached for your refrence.My current tool versionsKeil 5.37.0.0CMSIS 5.9.0STM32H7xx_DFP 3.0.0STM32CubeMX 6.6.1 and it's using STM32Cube FW_H7 V1.10.0

author: ataradov
author_rank: Super Contributor
timestamp: September 01, 2022, 04:58:35 pm
content: It would be better to post an build log. The parts of the warnings that are shown indicate that the code is using C99 compiler features and the project is probably configured for C89. Changing the standard version would probably fix a lot of that.And the rest should be fixed by looking at the errors and fixing whatever is wrong.

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 01, 2022, 06:27:29 pm
content: Yeah, what can we do with this screenshot? It shows you got warnings and errors, but doesn't show any of those warnings or errors themselves. So. Yeah."Houston, we have a problem!- Yeah?- ...(crash)"

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: September 03, 2022, 07:24:39 am
content: Thanks ataradov for the Tip, I have configured the compiler to C99 and most error and warnings are gone, Now I have only warnings, How can I get ride of themQuote

author: ataradov
author_rank: Super Contributor
timestamp: September 03, 2022, 07:28:38 am
content: You can just do what the warnings are saying. Add a 'noreturn' attribute to functions that intentionally don't return, remove extra semicolons.A typical way of "using" a parameter is casting it to void:Code:(void)Regulator;Alternatively you can just disable those warnings. All warnings here are just noise.
Where to publish array in code mqtt - Page 1
Forum section: electronics / general

author: King123
author_rank: Contributor
timestamp: September 02, 2022, 06:29:32 pm
content: In this sketch Where I need to write mqtt line client.publish("Receievd", input );Code://Arduino Unoint count = 0; // count = 0char input; // character arrayvoid setup(){Serial.begin(9600); // begin serial port with baud rate 9600bps}void loop(){if(Serial.available()){count = 0;while(Serial.available() && count < 12) // Read 12 characters and store them in input array{input = Serial.read();count++;delay(5);}Serial.print(input); // Print RFID tag number Serial.print("\n");if ( strcmp(input,"0A006FBE33E9") == 0){Serial.print("Tag One");Serial.print("\n");}Serial.print("\n"); }}}what would be correct line client.publish("Receievd", input ) or client.publish("Receievd", input );
PP5021C Processor - Page 1
Forum section: electronics / general

author: Fratink
author_rank: Contributor
timestamp: September 06, 2022, 08:34:42 pm
content: Does anyone know where I could find information about the PP5012C processor? I'm looking for a pinout or something so that I can debug issues on an old iPod I'm trying to repair. Since I can't find schematics at all I'm trying to figure out as much as I can from the parts.The PP series are from Portal Player, a fabless manufacturer purchased by nvidia in 2006. I've tried to contact nvidia about that but I'm not really expecting a response as I don't have the industry connections for that.If anyone knows where I should be looking that would be great. I'm sure this information is out there somewhere but I'm a bit stuck.Cheers,
C166 DSP lib [Solved] - Page 1
Forum section: electronics / general

author: manu
author_rank: Regular Contributor
timestamp: August 30, 2022, 10:02:47 am
content: Hi,For a legacy product, I am searching the C166 DSP lib files (maybe a .zip archive) with the source files Fir_16.c FloattoQ15.c Q15toFloat.c ,...If you know how to find it, I cannot download legacy uVision2 on the Keil website.Thank you for your help,Manu

author: manu
author_rank: Regular Contributor
timestamp: August 30, 2022, 11:48:10 am
content: My bad,I was searching on the Keil website, but the libraries are on the Infineon's:https://www.infineon.com/dgdl/XC166Lib_Keil.exe?fileId=db3a3043133ffd3001134443ead601faOther downloads dor c166:https://www.infineon.com/cms/en/product/microcontroller/legacy-microcontroller/legacy-8-bit-16-bit-microcontroller/c166-family/
USBDM programming bug when port drive strength bits set? - Page 1
Forum section: electronics / general

author: Circlotron
author_rank: Super Contributor
timestamp: August 29, 2022, 10:54:57 am
content: Had my USBDM programmer for some weeks now and it is the duck's guts! Love it.Struck a weird problem just now though. Had a 9S08PT16AVLC chip and usually these program easy peasy. This time I had three LEDs connected to PORT B 0,2 & 3 with a 1K resistor in series with each. I decided to set the port drive strength bits to "on" just for good measure. Set $1860 to #%00001101. After that the chip becameveryreluctant to connect to the programmer. Sometimes had to try twenty times or more. Resetting power every time. The "detect chip" button almost never worked either. Error message said it had lost connection. Eventually the detect chip would work and only after that I was able to program the chip. But my software would not run! After a lot of messing around I commented out the lines that gave the PORT B pins stronger drive, and... voila! Everything began to work perfectly! Programmed up and software ran great. Tried it half a dozen times or so. Now that's weird. Can anyone cast some light on this?Edit --> found it...Was using a S08FL datasheet instead of S08PT...Address $1860 is correct for PORT B drive setting in FL version but is in the "unimplemented" area of memory in a PT version.So that address actually seems to do something, but who knows what???

author: pgo
author_rank: Regular Contributor
timestamp: August 30, 2022, 11:47:55 am
content: Hi,It is unlikely that there is anything special about the memory location you are accessing.I think it is more likely that after programming the broken program that the chip is suffering form repeated resets cause by the 'illegal address' reset (this is a reset trigger on some 9s08 devices).This can make it difficult for the BDM to get a connection for long enough to actually activate the BDM interface and stop the processor.The only guaranteed way to program a 9s08 device is using a power-on-reset into active background mode. Most of the BDMs don't directly support this as they don't control the target Vdd.If the programming software has difficulty connecting it may request manual power sequencing but this may not happen in the above case since it makes an initial connection which is then lost after the reset.bye
Importing ST projects into Visual Studio Code - Page 1
Forum section: electronics / general

author: gmb42
author_rank: Frequent Contributor
timestamp: September 02, 2022, 01:02:34 pm
content: Blog post from MS about importing projects from STCube to Visual Studio Code using CMake.https://devblogs.microsoft.com/cppblog/importing-st-projects-into-visual-studio-code/
Embedded system events and action - Page 1
Forum section: electronics / general

author: King123
author_rank: Contributor
timestamp: August 20, 2022, 11:54:27 pm
content: I'm looking for some examples of system events and system actions in embedded systems.What is system event and system action in embedded system.

author: westfw
author_rank: Super Contributor
timestamp: August 21, 2022, 12:31:56 am
content: This is very context dependent, and if it's a test/homework problem, you pretty much need to parrot back whatever was said in the book or by the instructor.Normally, I'd say that a System Even or Action is one that is handled by the operating system rather than the user code. I could claim "An embedded system doesn't have an operating system, and therefore no events are system events" or "An embedded system encompasses everything that can happen, and therefore ALL events are system events", and those two contradictory statements might have an equal chance of being correct.In Arduino, I might say that a UART Interrupt is a system event, and the UART ISR code is the system action, since those are both handled by the "core" and not expected to involve the user "sketch." But other interrupts are NOT handled by the core, so they would earn the "System" label.

author: tggzzz
author_rank: Super Contributor
timestamp: August 21, 2022, 09:02:54 pm
content: Quote from: King123 on August 20, 2022, 11:54:27 pmIf this is a homework question, please quote the entire question.Otherwise, please give more context, so we can avoid the xy problem.https://entertaininghacks.wordpress.com/library-2/good-questions-pique-our-interest-and-dont-waste-our-time-2/

author: DiTBho
author_rank: Super Contributor
timestamp: August 23, 2022, 12:13:00 pm
content: I vaguely remember a book about event programming on Microchip dsPIC

author: jnz
author_rank: Frequent Contributor
timestamp: August 23, 2022, 08:21:34 pm
content: Quote from: westfwNicely put
minimum main loop size or timer interrupts don't work.  SAMD21 - Page 1
Forum section: electronics / general

author: snarkysparky
author_rank: Frequent Contributor
timestamp: August 23, 2022, 05:42:40 pm
content: Got this bit of code. TM3 is set up as an interrupt using match frequency generator. SAMD21J16BIf the main while loop is empty the TM3 interrupt does not decrement the counter. I assume its not firing.Put in some fluff to consume cycles and it works.What the hill ?Code:LED_PIN_HIGH();unsigned int stupidcounter = 1000000;while (1){if(!OneMsTimerVal){OneMsTimerVal = 1000; // ????OneMsWork();PortInputDebounce(&PortA);PortInputDebounce(&PortB);LED_TOGGLE();}// ********** if commented out TC3 interrupt does not fire. OneMsTimerVal does not decrement. LED stays ON and does not toggle.if(stupidcounter){stupidcounter--;}else{stupidcounter = 1000000;}//**********************************************************}// while(1)}// main

author: ataradov
author_rank: Super Contributor
timestamp: August 23, 2022, 05:53:33 pm
content: Are variables that used by both interrupt handler and the main loop declared volatile?If not, look at the disassembly, I bet your whole main loop got optimized out. As far as the main loop can see OneMsTimerVal never changes. Adding more code prevents this optimization.

author: snarkysparky
author_rank: Frequent Contributor
timestamp: August 23, 2022, 06:14:53 pm
content: ataradov.You are the man!! It's why you get the big bucks!making OneMsTimerVal volatile fixed the discrepancy.I would never have though the main loop would get optimized out.Thanks

author: ataradov
author_rank: Super Contributor
timestamp: August 23, 2022, 06:23:48 pm
content: This happens all the time when people are not careful about interrupts.Also, this is probably a weakness in the optimizer, since dummy code does not affect the part that still could be optimized. But it looks like bigger code prevents some optimizations from running.

author: cv007
author_rank: Frequent Contributor
timestamp: August 23, 2022, 07:12:23 pm
content: The loop may remain because you have 'volatile' things inside (like LED_TOGGLE), but the value loaded for OneMsTimerVal will simply use the register cached value over and over-https://godbolt.org/z/3r9hqq775change to volatile and OneMsTimerVal is read 'directly' each time.(asm lines ~15-18)Some of these optimizations also depend on what kind of linkage the var/function has, so there may be times when external linkage is involved so does not fully optimize away like you would think, and if only internal linkage you may see 'full' optimization-https://godbolt.org/z/osT35d8Ka

author: SiliconWizard
author_rank: Super Contributor
timestamp: August 23, 2022, 07:28:48 pm
content: This is a very common issue that SHOULD be taught in schools (it usually isn't) and that should be written in bold on your desktop background until it becomes second nature!It's unfortunate that most people - even in professional settings - usually learn this the hard way by accident, and then find out thanks to a colleague (if they are lucky) or through some web search/forums. Makes it look like black art or something.
Cypress/Infineon PSoC-64 'Secure Boot' device provisioning - Page 1
Forum section: electronics / general

author: PiersB
author_rank: Newbie
timestamp: August 23, 2022, 10:52:52 am
content: Has anyone been able to (or even attempted to) build your own JWTs for the PSoC64 device provisioning commands?I can use the examples (i.e. secure-blinky) and they work, but I'm having trouble getting my own JWTs (i.e., built and signed by a custom app) to be accepted during the first step of the provisioning process. There's a diagnostic indicating some internal check 'mismatch', but examining the JWT content shows the property to be present (albeit in a different location within the JSON payload from the examples). JWT keys are all EC and verify with external tools.Interested to here from anyone else working with this device. Thanks in advance!
[STM32] save TIM3->CNT to 2 variables for display? - Page 1
Forum section: electronics / general

author: kgavionics
author_rank: Regular Contributor
timestamp: August 21, 2022, 04:38:24 pm
content: HelloI'm trying to implement a simple menu to modify 2 variables (Volume and Contrast) using a rotary encoder hooked to TIM3 (encoder mode). What I want to achieve is when I press on the rotary switch it toggles between the 2 variables and then rotating the encoder, I can modify their respective values. My problem is I can't find a way to restore the saved counter when I toggle the switch. I tried to use 2 temporary variables, but it when I restore them to the TIM3→CNT doesn't updatePlease don't laugh on my code, I'm not a programmer by trade! I hope that someone cleaver in programming help me to resolve this issue!Thanks in advanceCode:{void rencoder(void){pb_scan();if(pushb==31){menucounter++;if(menucounter>2) menucounter=0;}switch(menucounter)case(0):volume=TIM3->CNT;//how to save this value without affecting the contrast variablebreak;case(1):contrast=TIM3->CNT;break;}}

author: wek
author_rank: Frequent Contributor
timestamp: August 21, 2022, 06:04:23 pm
content: > when I restore them to the TIM3→CNTShow that.JW

author: langwadt
author_rank: Super Contributor
timestamp: August 21, 2022, 10:27:32 pm
content: read the code again, look at what it does not what you think it doesyou repeatedly write the counter, of course it never counts

author: langwadt
author_rank: Super Contributor
timestamp: August 21, 2022, 11:14:26 pm
content: Quote from: kgavionics on August 21, 2022, 10:57:05 pmyou write the counter and then read the counter, what could you possibly read other than what you just wrote?

author: cv007
author_rank: Frequent Contributor
timestamp: August 22, 2022, 12:27:29 am
content: Your button push is when you want to restore the counter-Code:void rencoder(void) {pb_scan();if( pushb == 31 ){switch( ++menucounter ){default: menucounter = 0; // if not in a case below, start over at 0//fallthroughcase 0: TIM3->CNT = volume; break; //restore volume valuecase 1: TIM3->CNT = contrast; break; //restore contrast value}}switch( menucounter ){case(0):// changing volume valuevolume = TIM3->CNT;break;case(1):// changing contrast valuecontrast = TIM3->CNT;break;}}

author: kgavionics
author_rank: Regular Contributor
timestamp: August 22, 2022, 12:37:21 am
content: Thanks cv007, your code is working like a charm!You really made my day!Can you please explain thisCode:switch( ++menucounter )why ++menucounter?

author: cv007
author_rank: Frequent Contributor
timestamp: August 22, 2022, 03:46:09 am
content: QuoteWell, it just replaces the equivalent-if( pushb == 31 ){menucounter++;switch( menucounter ){where the increment takes place before the switch statement uses its value (pre-incremented), and the default case replaces checking for overflow.

author: kgavionics
author_rank: Regular Contributor
timestamp: August 22, 2022, 02:37:28 pm
content: Quote from: cv007 on August 22, 2022, 03:46:09 amAll clear now, Thanks
Old CBUS serial protocol specification-Any info out here? - Page 1
Forum section: electronics / general

author: djsb
author_rank: Super Contributor
timestamp: August 09, 2022, 04:16:04 pm
content: I'm trying to understand the Old CBUS serial protocol as used in the PCE2111 64 segment duplex LCD driver,SAA1057 PLL synthesizer and SAA1061 port expander (datasheets attached). According to section 10.1.3 page 18 of the i2c_spec.pdf file attached, the CBUS is similar to the I2C protocol which it predates. I'm beginning to learn to use my Logic16 logic analyser, so I'm starting with the PCE2111 first.Has anyone used this bus or know where I may be able to find the specification? Thanks.

author: Uunoctium
author_rank: Frequent Contributor
timestamp: August 11, 2022, 09:44:44 am
content: long time ago i looked up for some information about c-bus, because an (now outdated) HVAC Contoller by Honywell, MCR200 used it to combine with additional others and connect them to their building-control software, called excel.Most of information about was distributed by Clipsal, inventor of c-bus. Nowadays all of them are wiped, after Schneider aquired Clipsal. Maybe there is a little chance to recover them by archive.orgFound only an manual to setup an c-bus home-automation interface running in an docker container.Inside are some -dead!- links to original Clipsal documentshttps://buildmedia.readthedocs.org/media/pdf/cbus/latest/cbus.pdf

author: djsb
author_rank: Super Contributor
timestamp: August 11, 2022, 09:55:23 am
content: Thanks Uunoctium for your reply.That's a different thing altogether. C-BUS is for home automation (that's all I know about it-I don't have a home I can automate, so I'm not interested in it). The protocol I'm referring to is an inter integrated circuit communication serial protocol that was used before I2C was invented.I've got ALL the segments on the LCD lit up so far, so I've got the beginnings of a driver(with some help from the CCS C forum).I'll update this topic later as I make further progress. Thanks.

author: djsb
author_rank: Super Contributor
timestamp: August 19, 2022, 07:25:17 am
content: Here are the Revox B261 uP control block diagram, the uP controller schematic (which has a SAA1061-3 port expander) and the keyboard schematic which has a SAA1061-2 chip and a CD4532 priority encoder chip. I'm assuming that the -3 and -2 after the chip part number referes to the address that can be hard wired using pins 4 and/or 7 by connecting to VDD or ground as required. I am not sure how SAA1061 is addressed in the serial data stream or how the port direction is set? Can anyone help? Thanks.PS. SAA1061 datasheet is in the first post to this topic. Thanks.
Ethernet communication test - Page 1
Forum section: electronics / general

author: BlogRahul
author_rank: Regular Contributor
timestamp: August 19, 2022, 08:51:47 am
content: I have found this linkhttps://github.com/przemobe/micropy-ENC28J60.where to set IP address in code ?

author: eutectique
author_rank: Frequent Contributor
timestamp: August 19, 2022, 05:55:05 pm
content: Quote from: BlogRahul on August 19, 2022, 08:51:47 amClickhereandhere.

author: BlogRahul
author_rank: Regular Contributor
timestamp: August 20, 2022, 11:40:04 am
content: Quote from: eutectique on August 19, 2022, 05:55:05 pmI ran script and It show this outputMAC ADDR: xx:xx:xx:xx:xx:xxENC28J60 revision ID: 0x00How to test ethernet communication ?
STM32 Bluepill - Page 1
Forum section: electronics / general

author: geggi1
author_rank: Frequent Contributor
timestamp: August 14, 2022, 10:53:38 pm
content: Hi.I got some STM32 Bluepill boards that I'm playing with.Managed to upload the boot-loader with ST32Cube programmer.I'm a bit uncertain if i have used the correct boot-loader for the Arduino IDE. Can anybody please advice about what boot-loader to use?There is also the issue that windows dont recognize the device. I have done the R10 modification and using a 1k8 resistor.I'm a not certain that it is genuine chip on the board. Have been googling a bit and it seems to have the correct memory size.Can anybody send me a link with an updated description on how to get the Bluepill running in Arduino IDE?

author: ozcar
author_rank: Frequent Contributor
timestamp: August 15, 2022, 05:57:47 pm
content: I have programmed various blue and black pill boards using Arduino IDE, but have never bothered to try to get a bootloader to work. Instead I have a few cheap STLINK clones (as well as a few "real" STLINKs on Nucleo boards). That will give you a bit more available flash as none of it needs to be taken up by the bootloader.Using STLINK also leaves the door open for some real serious debugging using an IDE that supports that.In any event, you would probably be better off asking here:https://www.stm32duino.com/

author: thm_w
author_rank: Super Contributor
timestamp: August 15, 2022, 08:47:15 pm
content: Read the details here:https://github.com/rogerclarkmelbourne/STM32duino-bootloaderTry the file generic_boot20_pc13.bin, and gd32f1_generic_boot20_pc13.binI'll agree better off using stlink if you can, in combination with visual micro/visualgdb/PlatformIO.
about stm32 hardware design - Page 1
Forum section: electronics / general

author: ranganatennakoon
author_rank: Contributor
timestamp: August 15, 2022, 11:15:23 am
content: The stm32F103XX needs 2 oscillators. 8MHz is main one and 32KHz for RTC.If I don't use the RTC functions then adding the 32KHz oscillator is not essential right?thanks

author: gamalot
author_rank: Super Contributor
timestamp: August 15, 2022, 11:24:19 am
content: Yes, you are right, in fact both external crystals are optional and the STM32 can run without both of them.

author: JohanH
author_rank: Frequent Contributor
timestamp: August 15, 2022, 12:02:33 pm
content: If you use USB, the internal clock doesn't have good enough tolerance for the USB specification, although it might work in practice, but isn't guaranteed.

author: jordannedev
author_rank: Contributor
timestamp: August 15, 2022, 12:04:28 pm
content: https://www.st.com/resource/en/application_note/an2586-getting-started-with-stm32f10xxx-hardware-development-stmicroelectronics.pdfHere you will find all the basic information about the peripheral components that are required for the MCU. Personally, in my projects, I connect only the HSE crystal oscillator.

author: ajb
author_rank: Super Contributor
timestamp: August 15, 2022, 04:52:21 pm
content: Quote from: JohanH on August 15, 2022, 12:02:33 pmI don't know about these ST parts in particular, but some MCUs can use the USB SOF to discipline an internal oscillator, to allow USB to work without a more accurate local clock. But in general, yes, internal RC oscillators are much lower accuracy and stability and might not be good enough for sensitive applications, including UART links, so you'll have to look at the datasheet and do the math.

author: ranganatennakoon
author_rank: Contributor
timestamp: August 15, 2022, 10:40:05 pm
content: If I don't use the RTC functions then adding the 32KHz oscillator is not essential right?

author: thm_w
author_rank: Super Contributor
timestamp: August 15, 2022, 10:59:13 pm
content: Quote from: ranganatennakoon on August 15, 2022, 10:40:05 pmYes, gamalot answered this above.
Arduino and newer cheaper ZigBee radios? - Page 1
Forum section: electronics / general

author: stareatair
author_rank: Newbie
timestamp: August 07, 2022, 02:12:27 am
content: Hello all.I'm a longtime user of Arduino and Digi XBee units, running and maintaining Zigbee mesh networks of about 20 units each.My deployments use Arduinos (mostly Nanos), connected serially to the classic Digi Brand Zigbee S2 through-hole modules.The Digi radios are great, but with progress and shortages, the modules are getting expensive, approaching $50US each if you can get them.Has anyone had success using any of the newer cheaper ZigBee modules in similar configurations?I realize that these newer modules are complete SoCs, but I'm mostly interested in setting them up to be relatively dumb Zigbee modems that remain connected to Arduinos running the main application. I'm willing to change the Arduino code to use a different API, but porting all of the code to a new platform would be a non-starter. (the logic is a bit complicated, and more importantly, well proven)This would be for new deployments so they would not have to coexist with Digi modules, but I would hope to get about the same performance and reliability when deployed.Experience?

author: e100
author_rank: Frequent Contributor
timestamp: August 07, 2022, 04:09:35 am
content: I'm not aware of any clones of the Digi Xbee. The pricing, unfriendly form factor and "think in hex" tools have always been aimed at the professional market.A few years ago they accidentally became popular with hobbyists because they were the only mesh option available.Devices such as the TI CC2531 and successors are cheap, but you'd need to look at the API docs to see if there is any similarity to the Digi devices.Today there are mesh WiFi options and long range LoRa devices that may be able to do the same job as a zigbee network at a cheaper price.

author: rooppoorali
author_rank: Regular Contributor
timestamp: August 08, 2022, 12:26:41 pm
content: Only this one is available I can see.https://www.dfrobot.com/product-1571.html

author: e100
author_rank: Frequent Contributor
timestamp: August 08, 2022, 01:31:31 pm
content: Quote from: rooppoorali on August 08, 2022, 12:26:41 pmThat appears to be a WiFi only module packaged to fit the Xbee form factor.I don't see any mention of Zigbee.

author: stareatair
author_rank: Newbie
timestamp: August 11, 2022, 05:15:03 pm
content: Thank you all for comments. I like the "accidentally became popular" angle.There are so many examples and tutorials on the web about interfacing Arduinos with Digi XBees. I'm surprised that I can't find any where somebody chats a bit about accomplishing the same thing with something newer and cheaper.Maybe I have to figure it out and "be that guy".

author: thm_w
author_rank: Super Contributor
timestamp: August 12, 2022, 12:41:38 am
content: https://github.com/xyzroe/ZigUNOCC2530

author: stareatair
author_rank: Newbie
timestamp: August 13, 2022, 05:19:07 pm
content: Ordered a pair to play with, thank you for the link thm_w!
STM32G0B1 noisy adc values - Page 1
Forum section: electronics / general

author: jordannedev
author_rank: Contributor
timestamp: August 10, 2022, 07:26:32 am
content: Good day colleagues.In my current project I'm using STM32G0B1 but I have some issues with reading ADC values. The ADC is in oversampling mode in order to read 16bit values. There is a lot of noise in the readings and I can't figured out what is the reason for that. I set up the ADC to be updated by TIM2 with different frequencies but the results were the same. On the input I try with different sources - DAC and function generator. For now the only thing that help was moving averaging filter with window of 100 elements and low ADC update speed of 1kHz but this introduce a lot of delay in reading the value. Now I'm thinking to put on the input active low pass filter in order to reduce the high frequency noise. If someone have experience with such a problems, please share ideas how to solve this issue.

author: wek
author_rank: Frequent Contributor
timestamp: August 10, 2022, 07:33:05 am
content: Quote from: jordannedev on August 10, 2022, 07:26:32 amDon't have unrealistic expectations. You are using an ADC embedded in what's essentially a massive noise source (thousands of transistors switching synchronously). A couple of LSB noise on the raw 12-bit results is to be expected even with perfect hardware design - and it HAS to be quite perfect, every millivolt of deviation/noise in VSSA/VREF-/VDDA/VREF+ is directly reflected on the ADC output. Averaging won't do magic.Read AN2834.Try with a low-impedance DC signal source first.JW

author: thm_w
author_rank: Super Contributor
timestamp: August 10, 2022, 11:11:36 pm
content: Schematic?Oscilloscope capture of input?Oscilloscope capture of Vdda/Vref?

author: jordannedev
author_rank: Contributor
timestamp: August 11, 2022, 02:39:17 pm
content: The problem is solved. I change the way of taking samples and the algorithm for calculating final ADC value. Now the calculation is much faster and the final compute value is stable.

author: eugene
author_rank: Frequent Contributor
timestamp: August 12, 2022, 01:07:37 pm
content: Care to share what you learned?

author: jordannedev
author_rank: Contributor
timestamp: August 13, 2022, 07:27:49 am
content: I'm using timer to update the ADC(update event) with freq. of 100kHz. In the DMA buffer I take 100 values. Then in the ADC callback I make the calculation from the 12bit values for the oversampled 16bit value.The calculation in the callback is :avg = 0;for(int16_t i = 0; i < nsamples; i++)avg += samples;adcVal = ((avg * (1 << (adcOver- adcNative)) + nsamples/ 2) / nsamples);where:avg is sum of the taken samplesnsamples number of samples (in my case 100)adcOver is 16adcNative is 12adcVal is calculated 16bit adc value
Linux branch and distributions - Page 1
Forum section: electronics / general

author: BlogRahul
author_rank: Regular Contributor
timestamp: August 09, 2022, 09:08:07 am
content: Is there any difference between branch and distribution in the context of Linux ?This pagehttps://en.wikipedia.org/wiki/List_of_Linux_distributionsgives me list of distributions.I don't know how branch is different from distribution ?

author: retiredfeline
author_rank: Frequent Contributor
timestamp: August 09, 2022, 09:19:15 am
content: A Linux distribution is a Linux kernel, plus software surrounding it, to make it a usable system for its purpose. A distribution is what people install.Branch is a general term for a particular series of a piece of software, not just the Linux kernel. Developers care about branches, most users don't.

author: Whales
author_rank: Super Contributor
timestamp: August 09, 2022, 11:46:57 am
content: A "branch" is something that has been "branched off". All Linux distros are derivatives of something else in some way, so all can be considered to be "branches" in some way.Other times the word "branch" is used specifically to refer to branches in version control repositories (like git, svn, etc).

author: brucehoult
author_rank: Super Contributor
timestamp: August 09, 2022, 01:19:42 pm
content: A branch is a series of changes ("commits") to some software project. All, or almost all, changes eventually make their way on to the "main" (or "master" before the PC Police pounced in about 2020) branch. Often someone making a new feature or fixing a bug will do their work on a branch only they are adding things to, ignoring for a time what is happening on the main branch. Once the work is complete and checked they will merge it to the main branch -- or perhaps first to a testing / QA branch.From time to time enough new features will have been added or bugs fixed to make a release. The current tip of the main branch is tagged wth the release name, and a new maintenance branch started. General development will continue on the main branch, and only important bug fixes will be made on the release branch.This happens for every different project. The Linux kernel is one such project. Binutils is another. Gcc is another. glibc (and alternatives such as musl or newlib) are others.From time to time, various organisations take some set of versions of various projects, test them together, and make a "distribution".The simplest distribution is pretty much just the kernel and a statically linked busybox. Obviously some such as Fedora or Ubuntu are a lot more comprehensive.

author: gnif
author_rank: Unknown
timestamp: August 11, 2022, 10:54:18 am
content: Quote from: BlogRahul on August 09, 2022, 09:08:07 amNot a Microcontroller question, again, general computing/programming, please usehttps://www.eevblog.com/forum/general-computing/Locking Thread
Converting HC11 assembly to C - Page 1
Forum section: electronics / general

author: metertech58761
author_rank: Frequent Contributor
timestamp: August 01, 2022, 05:50:19 am
content: OK, as mentioned in my (failed?) HC11 project thread, here's the firmware for that project.The file "config term dump" was generated by feeding the EPROM dumps through f9dasm and annotating as needed.The file "config term source" was after I'd taken the time to study the code.I removed some functionality I knew I would not need (one set of tests was basically for a bespoke line of equipment and not of interest) and reworked the rest for clarity and consistency.I'll let those interested parties have a look to see if I was on the right track in cleaning up the assembly code, then i'll get to the parts I was having trouble porting to C.

author: metertech58761
author_rank: Frequent Contributor
timestamp: August 03, 2022, 08:04:55 am
content: I remember now. I'd posted my nearly finished attempt at rewriting the interrupt code only to get picked on for too many goto statements in the code.Unless I am convinced otherwise, I think I've reached the washed-out bridge.

author: metertech58761
author_rank: Frequent Contributor
timestamp: August 06, 2022, 04:23:58 am
content: Here's the code that I had for the interrupt section - again, this is after I tried to minimize the number of goto statements and still have six opcodes (ROL / ROR) to figure out how to translate.
AnyWire: Arduino library for using Wire (I2C) and SoftwareWire simultaneously - Page 1
Forum section: electronics / general

author: cellularmitosis
author_rank: Unknown
timestamp: August 04, 2022, 06:24:46 am
content: I wrote an abstraction layer to allow using hardware and software I2C at the same time:https://github.com/pepaslabs/AnyWireIncluded in the repo is a copy of SoftwareWire, as well as a forked copy of HTU2xD_SHT2x_Si70xx which has been modified to support AnyWire, and a demo sketch which reads from two temperature sensors, one over hardware I2C and the other over software I2C.Cheers!
ch340g DTR pin to nRST pin of GD32F103 - Page 1
Forum section: electronics / general

author: mclute0
author_rank: Regular Contributor
timestamp: August 01, 2022, 05:10:22 am
content: usb to uart bridge ch340g DTR pin to nRST pin of GD32F103 via 1kohm resistor.does this sound like a good idea? Seems every time you connect to the serial port it resets the entire system and an app that takes DTR low to reset errors can make for a continuous reboot cycle. Take out resistor and add a reset switch?

author: rooppoorali
author_rank: Regular Contributor
timestamp: August 02, 2022, 04:59:20 am
content: The reset switch sounds the better idea to me.
how to dump the firmware from Arduino Mega? - Page 1
Forum section: electronics / general

author: DiTBho
author_rank: Super Contributor
timestamp: July 31, 2022, 02:41:15 pm
content: I have never played with that stuff, and rarely play with Arduino, probably it's a silly question but ... I really don't know.Is it possible to dump the firmware of an Arduino Mega without corrupting the flash(1)?if so, how? Does it require an Avr-Dragon or something?(dunno anything about FUSE and protections)(1) I am not sure the flash contains the standard Arduino bootloader, it may contain a custom loader, so I'd like to avoid to inject a dumper.I am only sure that's the board is an Arduino Mega, I don't know anything about its firmware, except ... I'd like to download and disassembly for personal interest.

author: pcprogrammer
author_rank: Super Contributor
timestamp: July 31, 2022, 04:00:43 pm
content: An Arduino Mega, when based on an atmega2560, has JTAG, so you should be able to use that to get the content of the FLASH.Have not done this myself, and don't know which software can be used for it. Did buy a jtag adapter for it way back:https://nl.aliexpress.com/item/32985895910.htmland do have an Arduino Mega lying around. Can do some experiments if needed.Edit1:https://forum.arduino.cc/t/small-guide-to-arduino-atmega2560-jtag-interfacing-with-avrstudio6/186473Edit2:https://doc.riot-os.org/group__boards__arduino-mega2560.htmlEdit3:https://www.rapid7.com/blog/post/2019/04/16/extracting-firmware-from-microcontrollers-onboard-flash-memory-part-1-atmel-microcontrollers/

author: westfw
author_rank: Super Contributor
timestamp: July 31, 2022, 10:07:07 pm
content: If it does have the Arduino bootloader, you can extract the flash contents using that, over the serial port, using avrdude. Worth a try.If it doesn't have a bootloader, the next thing to try is an ISP programmer. There are lot of sources of AVR ISP programmers. (Some of them have trouble with >128k of flash.) AVR Dragon is old and pretty obsolete. I've heard good things abouthttps://www.pololu.com/product/3172for a low-cost programmer Official Microchip programmers would include the SNAP and the PicKit4. If you have "other" Arduino boards, you can use the "Arduino as ISP" sketch (maybe. Note sure about the 256k issue.) (all assuming that the chip has not been "protected" against having its code read.JTAG needs to be specifically enabled via a fuse setting, so it probably still needs an ISP programmer.
OV5640 - HTS & VTS - Page 1
Forum section: electronics / general

author: aymjo
author_rank: Newbie
timestamp: July 27, 2022, 12:46:05 pm
content: Hi.I have a project with OV5640 image sensor. i need a custom definition of 800 x 800 px at 30 fps if possible. How can i find the HTS & VTS values for 380C 380D 380E and 380F registers? I don't want to have just the values, but how to determine it!(https://cdn.sparkfun.com/datasheets/Sensors/LightImaging/OV5640_datasheet.pdfhere is the datasheet, page 42)Thank you in advance !

author: Scrts
author_rank: Frequent Contributor
timestamp: July 27, 2022, 06:27:18 pm
content: HTS and VTS are Total Size parameters, which include blanking areas, I guess.I'd say try to reverse engineer from examples here:https://github.com/ArduCAM/Arduino/tree/master/ArduCAMSee filehttps://github.com/ArduCAM/Arduino/blob/master/ArduCAM/ov5640_regs.hLine 4416
QMC5883L temperature sensor - Page 1
Forum section: electronics / general

author: wilhe_jo
author_rank: Regular Contributor
timestamp: July 22, 2022, 05:25:22 pm
content: Hi!Anyone got a temper reading from the QMC5883L?The magnetic sensor part seems to give me reasonable values, but the temperature always reads 0.Regards,Johann

author: rooppoorali
author_rank: Regular Contributor
timestamp: July 24, 2022, 02:26:01 pm
content: I didn't see anyone using QMC5883L for temperature reading. I think for temperature reading, It's better to add an LM35 to the setup for dependable readings.https://www.theengineeringprojects.com/2019/01/introduction-to-lm35.html

author: DavidAlfa
author_rank: Super Contributor
timestamp: July 26, 2022, 04:42:39 pm
content: What kind of answer is that? It has temperatuire sensor, so it should be usable:Code:9.2.3 Temperature Data RegistersRegisters 07H-08H store temperature sensor output data. 16 bits temperature sensor output is in 2’s complement.Temperature sensor gain is factory-calibrated, but its offset has not been compensated, only relative temperaturevalue is accurate. The temperature coefficient is about 100 LSB/℃Are you reading regs 0x07 & 0x08? Are they both reading 0?

author: rooppoorali
author_rank: Regular Contributor
timestamp: July 27, 2022, 09:52:05 am
content: Quote from: DavidAlfa on July 26, 2022, 04:42:39 pmI did not say that the QMC5883L's in-built temperature sensor can't be used. I meant that it's not convenient and may not be always accurate. For example, in one of my projects I had a Barometric Pressure Sensor BMP-180. It could output Pressure and temperature, both. Still, I had to add a separate temperature and humidity sensor to my project. I noticed a significant difference between the temperature readings of BMP-180 and the other sensor. The BMP-180's reading was nowhere close to the real one. Later, I came of know that BMP-180 was not dependable for temperature readings. Anyway, if anybody has succeeded in getting the correct temperature value from QMC5883L, I'd love to know the method too.