hybridfree/eevblog-posts huggingface dataset:
Programming ATmega32U4 with USBASP - Page 1
Forum section: electronics / general

author: avf32
author_rank: Newbie
timestamp: August 27, 2021, 01:01:27 pm
content: Hi all,I'm trying to program an ATmega32U4 on my breadboard with a USBASP programmer, but all I'm getting is:avrdude: warning: cannot set sck period. please check for usbasp firmware update.avrdude: error: program enable: target doesn't answer. 1avrdude: initialization failed, rc=-1Double check connections and try again, or use -F to overridethis check.I've double- and triple-checked with my multimeter that the connections are correct by probing the pins on the MCU and the corresponding pins on the programmer. Just in case the MCU was set to use a crystal (though in theory it's brand new and should be configured to use the internal oscillator), I've stuck a crystal on it (with 22pF caps to ground, and I have tried two crystals). The progammer definitely works, I program ATtiny84As with it regularly.The only ideas I have left are trying to update the firmware on the programmer (which I will do once I get a second one), and the MCU being faulty.Is there anything else I could have missed?Many thanks,Alex

author: avf32
author_rank: Newbie
timestamp: August 27, 2021, 01:32:01 pm
content: I was missing the pull-up on the reset pin. Double-checked, and it does need the crystal.The fuses are indeed set to the factory defaults, but I also missed this note in the datasheet: "The default setting of CKSEL3..0 results in Low Power Crystal Oscillator for ATmega16U4 and ATmega32U4, and Internal RC oscillator for ATmega16U4RC and ATmega32U4RC."avrdude: warning: cannot set sck period. please check for usbasp firmware update.avrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.01savrdude: Device signature = 0x1e9587 (probably m32u4)avrdude: safemode: Fuses OK (E:F3, H:99, L:5E)
Does any of dsPic30f familly comes with plcc package. - Page 1
Forum section: electronics / general

author: Dinos Tsakalakis
author_rank: Newbie
timestamp: August 25, 2021, 08:04:42 am
content: Hallo , I am designing a dev board ,using a dsPic30f2023 microprocessor butt it sounds a good idea to place it on a socket first ,so i was wondering if there is any DSC processor in plcc package, especially searching for dsPic family.I have already found plcc package for DSP processors but not for DSC's.Any suggestions;Thenk you.

author: JPortici
author_rank: Super Contributor
timestamp: August 25, 2021, 08:17:18 am
content: No.But there are many in DIP package.Besides dsPIC30F is old, slow and clunky as hell. if you NEED 5V use the dsPIC33EV

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 25, 2021, 01:35:57 pm
content: You also have affordable tqfp/tssop/soic sockets in AliExpress.

author: SiliconWizard
author_rank: Super Contributor
timestamp: August 25, 2021, 05:19:24 pm
content: The only Microchip MCUs that are available in PLCC are in the PIC16 and PIC18 family AFAIK. So forget about it.DavidAlfa's suggestion seems reasonable if you absolutely want a socket. An alternative would be to use a board adapter and a PLCC, DIP or PGA socket.

author: fchk
author_rank: Frequent Contributor
timestamp: August 25, 2021, 08:36:19 pm
content: Quote from: Dinos Tsakalakis on August 25, 2021, 08:04:42 amno. The times of PIC programmers where you program your DIL type chip of of the circuit is long gone. Nowadays you use ICSP to program and debug your chip. There is no need for soecketing the PIC any more.And: Don't use dsPIC30! There are newer, much faster and better dsPIC33 alternatives.fchk

author: PCB.Wiz
author_rank: Super Contributor
timestamp: August 25, 2021, 11:09:25 pm
content: Quote from: Dinos Tsakalakis on August 25, 2021, 08:04:42 amWe had a MCU in PLCC, where we replaced the sockets in a re-design, as they were climbing in price, and were getting field problems in dusty, remote locations from the contacts.
Eclipse S32D dump export array via GDB with j-link - Page 1
Forum section: electronics / general

author: rvalente
author_rank: Frequent Contributor
timestamp: August 24, 2021, 12:14:26 pm
content: Hello mates,i've an array (buffer) with 5000 ints, I need to export this data, can be a copy and paste or export to csv but, i need them to be ints.I was able to export as intel hex using the command:dump ihex value d:dump.txt bufferbut the data, of course, comes as intel hex and if it was a CSV would be much easier to deal with.I cold use the serial with prints, sure, but the debugger has this resource, I'd like to use it because seems much more flexible.Maybe some one has a script?Greeting
STM32F103F rtc circuit - Page 1
Forum section: electronics / general

author: teslinius
author_rank: Regular Contributor
timestamp: August 21, 2021, 02:26:27 pm
content: I want to use the built in rtc circuit in the microcontroller, i connected the 32.768kHz crystal to OSC32 pins and the battery to VBAT, but there is PC13 pin which says tamper-rtc, i checked the datasheet, but it didn't exactly say where to connect this also didn't find correct information on the internet.Does anyone know if it needs to be connected anywhere?

author: thm_w
author_rank: Super Contributor
timestamp: August 23, 2021, 10:27:09 pm
content: You don't need it unless you want some kind of tamper protection. eg to delete encryption keys if a case door is opened.google:https://www.st.com/content/ccc/resource/training/technical/product_training/group0/44/60/e0/b2/ee/f4/47/ff/STM32F7_WDG_TIMERS_RTC/files/STM32F7_WDG_TIMERS_RTC.pdf/jcr:content/translations/en.STM32F7_WDG_TIMERS_RTC.pdfQuote

author: langwadt
author_rank: Super Contributor
timestamp: August 23, 2021, 10:37:37 pm
content: Quote from: thm_w on August 23, 2021, 10:27:09 pmdo the 103 actually have any of the tamper stuff? all I can find about is for other families of stm32, as in your link the F7

author: thm_w
author_rank: Super Contributor
timestamp: August 23, 2021, 11:24:37 pm
content: Quote from: langwadt on August 23, 2021, 10:37:37 pmYes, quick way to check is in cubemx, the option is there for F103.
SCPI parser library for Rust - Page 1
Forum section: electronics / general

author: Atmelfan
author_rank: Newbie
timestamp: December 20, 2019, 09:13:06 pm
content: https://github.com/Atmelfan/scpi-rs;https://docs.rs/scpi/Thought it might be interesting to someone here, otherwise pretty niche with SCPI(https://en.wikipedia.org/wiki/Standard_Commands_for_Programmable_Instruments)+Rust.Still in a pretty early state but most of the basic parsing is done and it can be used for simple implementations. Some standard commands are stubs, haven't been very thorough with the errors it emits and some syntax is missing. I've an example running on a STM32F415, using 24 KiB flash (could probably be optimized a bit better and the example uses semihosting+core::fmt which adds a bit), it has no HW dependencies so it should be capable of running on any target supported by rust.Example output fromhttps://github.com/Atmelfan/scpi-rs/blob/master/example-cortexm/src/main.rs:Code:SCPI >> *IDN?; *ESR?RESPONSE: Cyberdyne systems,T800-101,0,0;0SCPI >> this:is:an:invalid:command?ERROR: Undefined headerSCPI >> *ESR?RESPONSE: 32SCPI >> syst:err?RESPONSE: -113,"Undefined header"SCPI >> system:error?RESPONSE: 0,"No error"Sorry if this is too much of a plug (I'm the author if it wasn't clear), I think this is probably the only place with people who cares about SCPIand possibly Rust.

author: sjm
author_rank: Contributor
timestamp: August 21, 2021, 11:14:36 am
content: Sorry for a really stoopid question, but this is strictly meant to aid creation of an SCPI server on some kind of embedded hardware etc?I am looking for a client-side SCPI crate to command my homelab devices...BR, -sjm
Serial.println()  - Page 1
Forum section: electronics / general

author: thelearner
author_rank: Contributor
timestamp: August 19, 2021, 04:59:16 am
content: Hello,I have a standalone device with ATtiny85 MCU running Arduino firmware. In the firmware there are serial.println() functions that write its status to the serial port. Since it is a standalone device serial port is not connected to a system or to any other device.Will this affect the device in any way in the long run?TIARegards,thelearner

author: sleemanj
author_rank: Super Contributor
timestamp: August 19, 2021, 05:41:12 am
content: No, as long as nothing is connected to the serial pins, no problem.

author: Rick Law
author_rank: Super Contributor
timestamp: August 21, 2021, 05:00:01 am
content: One thing to consider... Why would you want to bring in the serial library (which is not small) and add complication.I would think, eliminating those serial related codes with #define then #if to block them out would be a far superior way to handle them rather than leaving the serial.whatever() in place relying (hoping) it would do no harm.

author: brucehoult
author_rank: Super Contributor
timestamp: August 21, 2021, 07:33:30 am
content: Quote from: Rick Law on August 21, 2021, 05:00:01 amNot all that much, even for an ATTiny85. I don't have the ATTiny package installed on this machine, but it won't be much different to the 328.Adding Serial.begin(9600) to a sketch adds 994 bytes of code.Serial.println() of an int adds 98 bytes more.Serial.println() of a string instead adds 36 bytes.Printing both an int and a string adds 104 bytes  over just Serial.Begin() or 1098 bytes over the sketch with no use of Serial at all.Those numbers include the call to the library as well as the library code. that's so little more than just printing an int that I expect it's not actually adding any more library code, and the 6 bytes difference is simply the call to the string print function.ATTiny85 has 8K of program space, so using 1K for Serial is probably usually not a big deal. You probably want to have the ability to add debug printing if necessary, so leaving that flash space empty in production deployments doesn't actually save anything.
Dump firmware from an 8051 variant - Page 1
Forum section: electronics / general

author: zer0c00l
author_rank: Contributor
timestamp: August 16, 2021, 09:45:11 pm
content: I am trying to dump firmware from a Chinese MCU SC93F8333 (Shenzhen SinOne Microelectronics Co). It has an 8051 core and uses cJTAG (a compact variant of JTAG with only 2 pins CLK, and TMS). I bought a USB programmer from Taobao (manufactured by the same company) hoping it would be able to read the firmware as well, but to my surprise the software that came with it only supports flashing the firmware on the MCU and has no options to read it. I also tried Segger J-Link which supports cJTAG, but had no luck there either (it looks like J-Link only supports SiLabs variant of 8051). Any ideas

author: abyrvalg
author_rank: Frequent Contributor
timestamp: August 19, 2021, 12:37:49 pm
content: Study the tool for some buried read function (i.e. in some dll). Programming tools often have some way of verifying the flashed image, that can be reading and comparing.The next level would be to study the programmer - look for some firmware update on the web or bundled to the tool and study the protocol.

author: zer0c00l
author_rank: Contributor
timestamp: August 23, 2021, 05:15:01 pm
content: Quote from: abyrvalg on August 19, 2021, 12:37:49 pmIt does have verify firmware option. I did have a thought about this but wasn't sure how I would proceed. My thought process was to capture the traffic between the programmer and MCU using a logic analyzer when I click the "Verify" button, and then somehow use that?

author: abyrvalg
author_rank: Frequent Contributor
timestamp: August 24, 2021, 02:40:02 pm
content: Yes, something like that. You can try writing & verifying known data to a similar blank chip first. This way you’ll know the bit patterns to look for in the dump.
ATtiny85 - Working with EEPROM in IDLE mode - Page 1
Forum section: electronics / general

author: thelearner
author_rank: Contributor
timestamp: August 19, 2021, 05:02:07 am
content: Hello,I am working with the ATtiny85 board. I am working with data EEPROM and sleep modes of EEPROM. I have the following questionsCan we write data into Data EEPROM of ATtiny85 when the device is in IDLE sleep mode?Will the data retain in EEPROM if data is written in IDLE sleep mode?TIARegards,thelearner

author: brucehoult
author_rank: Super Contributor
timestamp: August 19, 2021, 08:06:26 am
content: Your program has to be running to write data to EEPROM using EEPROM.write() (Arduino) or eeprom_write_byte() (gcc library).Of course you can go back into a low power mode afterwards.
16 bit PIC dsPIC33FJ12MC201 QEI counter - Page 1
Forum section: electronics / general

author: perdrix
author_rank: Frequent Contributor
timestamp: August 18, 2021, 03:39:50 pm
content: Has anyone got an example piece of code to maintain a 32 bit (or longer) position counter on a 16 bit dsPIC33FJ12MC201 PIC using the QEI POSCNT interrupt (taking into account the fact that there's an errata that the interrupts won't actually fire unless you set MAXCNT to 0x7fff?ThanksDavid
PICKit 2 - No Device Detected - Page 1
Forum section: electronics / general

author: aless2056
author_rank: Contributor
timestamp: August 13, 2021, 02:44:35 am
content: PICKit 2 - No Device DetectedHello people,I got 2 clone recorders. When I go to record or read something in any uc, the PICKit 2 Programmer shows the screen with yellow background with the message "No Device Detected".I checked the board's components and didn't find the damaged one.Anything hints where to start?http://lojauptex.com.br/p-1832651-UP-Prog---Gravador-de-Microcontroladores-PIC---PICKit2

author: fchk
author_rank: Frequent Contributor
timestamp: August 14, 2021, 05:11:33 pm
content: PICKIT2 is very outdated. It won't support newer PICs, no PIC32, no PIC16(L)F with 4 or 5 digits type numbers, and the current MPLABX wount be able to use it.I recommend getting a cheap PICKIT3 clone. This works with all PICs and current Windows and MPLABX versions. Or PICKIT4 or SNAP, which additionally support AVR and ARM.fchk

author: Ian.M
author_rank: Super Contributor
timestamp: August 14, 2021, 05:55:11 pm
content: I've looked at your link, and unless there are a whole bunch of SMD parts under the board, it simply doesn't have enough transistors to be a true PICkit 2 clone. I see four on your board, and the real deal has seven + three MOSFETs (two in one dual package) and an OPAMP. Apart from variable Vpp and Vdd generation, and control, three of the transistors are responsible for clamping the programming signals, providing level control and protection. Your board almost certainly lacks these, and I suspect its 5V only.A genuine PICkit 2 or a good clone would be worth fixing, but without the protection circuits, odds are its fried a pin on the MCU and as a new PDIP PIC18F2550, (as used in your clone) is at least $5 USD, its just not cost-effective, so I'm with Fchk on this - get a full PICkit 3 clone, (not a Muntzed one).
Arduino IDE fails to compile EasySMU for Linduino One due to missing header file - Page 1
Forum section: electronics / general

author: ixfd64
author_rank: Frequent Contributor
timestamp: August 13, 2021, 04:40:40 pm
content: I'm trying to compile theEasySMUapplication for a setup consisting of a DC2026C and two DC2591A boards. I got an error about some missing dependencies but managed to resolve this by creating and importing .zip files for the LT_I2C, LTC2485, LTC2655 and EasySMU libraries. However, Arduino IDE still complains thatLinduino.hcould not be found.The linked repository does contain this file. I put it in a .zip file and tried to import it using the "Add .ZIP Library..." option, but Arduino IDE says the file doesn't contain a library. Copying the file to the same directory as the .ino file did not make a difference either. Anyone know what I'm doing wrong?

author: darkspr1te
author_rank: Frequent Contributor
timestamp: August 14, 2021, 08:06:54 am
content: Hi,This answer may helphttps://forum.arduino.cc/t/problem-with-loading-a-header-file/554099/5

author: ixfd64
author_rank: Frequent Contributor
timestamp: August 14, 2021, 04:55:26 pm
content: Quote from: darkspr1te on August 14, 2021, 08:06:54 amI tried this earlier, but it didn't work for me. Thanks, though!

author: ixfd64
author_rank: Frequent Contributor
timestamp: August 14, 2021, 05:39:18 pm
content: Update: I got it to work by copying the entirelibrariesfolder from the repository to my Arduino workspace.
seeking a freescale HCS08 binary/hex debugger/disassembler - Page 1
Forum section: electronics / general

author: kolonelkadat
author_rank: Regular Contributor
timestamp: November 05, 2013, 03:57:01 am
content: I was wanting to have a poke around the firmware on a mc9s08jm32 (Freescale). Sadly, my version of IDA doesnt have built in support for freescale processors.Can anyone link me to a disassembler that supports the HCS08 processor? Preferably an IDA plugin if possible. Id really appreciate it.

author: amyk
author_rank: Super Contributor
timestamp: November 05, 2013, 08:55:22 am
content: Writing your owndoesn't look that hard...

author: kolonelkadat
author_rank: Regular Contributor
timestamp: November 06, 2013, 03:47:15 am
content: I doubt its hard, but im also sure that one already exists since Freescale is listed as a supported cpu on th IDA website, but apparently not in whatever version im using.I just really hate to reinvent the wheel, ya know?

author: digsys
author_rank: Unknown
timestamp: November 06, 2013, 04:35:15 am
content: That was my previous favourite processor series. I have heaps of tools for it, but I won't be back in the office for afew hours. I'll let you know then.

author: kolonelkadat
author_rank: Regular Contributor
timestamp: November 06, 2013, 07:41:04 am
content: right on man. I'd appreciate any cool tools you've got.

author: digsys
author_rank: Unknown
timestamp: November 07, 2013, 02:14:18 am
content: Sent you a PM

author: codeboy2k
author_rank: Super Contributor
timestamp: November 07, 2013, 08:46:03 am
content: oh me too please.. I have a desire to mess around with an old HCS08 board I have lying aboutthanks

author: digsys
author_rank: Unknown
timestamp: November 07, 2013, 12:45:34 pm
content: PM sent

author: pund
author_rank: Newbie
timestamp: November 18, 2013, 11:29:03 pm
content: I too have been looking for an HCS08 IDA module.Any chance I could get it as well?Thanks.

author: cae20452
author_rank: Newbie
timestamp: February 05, 2021, 05:33:32 pm
content: if already stay me too please , thanks

author: ale500
author_rank: Frequent Contributor
timestamp: February 05, 2021, 06:53:10 pm
content: Ghydra could also have something useful, but I haven't checked.

author: Martinthemaker
author_rank: Newbie
timestamp: August 11, 2021, 10:23:16 pm
content: I'm also looking for a Freescale dissasembler/ decompiler
[SOLVED] ATmega328P USART not working - Page 1
Forum section: electronics / general

author: Kalcifer
author_rank: Regular Contributor
timestamp: August 11, 2021, 06:15:01 am
content: Alright, I have absolutely no idea what is going on here. I'm just getting the basic UART set up for a project I was planning, and was just doing a quick test of transmitting one character, but for whatever reason it isn't working, and I have absolutely no idea why.Code:#define __AVR_ATmega328P__#include <avr/io.h>#define USART_BAUD_PRESCALER 51// Initialize the USARTvoid usart_init(void){// Set the baud prescalerUBRR0H = (unsigned char) (USART_BAUD_PRESCALER >> 8);UBRR0L = (unsigned char) USART_BAUD_PRESCALER;// Set the frame size of the receiver and transmitter to 8-bitsUCSR0C |= ((1 << UCSZ01) | (1 << UCSZ00));// Enable the transmitter and the rceiverUCSR0B |= ((1 << TXEN0) | (1 << RXEN0));}// Transmit data over USARTvoid usart_transmit(unsigned char transmit_data){// Wait for empty transmit bufferwhile (!(UCSR0A & (1 << UDRE0)));UDR0 = transmit_data;}int main(){usart_init();while (1){usart_transmit('a');}}I'm probing the TXD pin on the ATmega328P with my scope, and I'm seeing nothing.

author: Kalcifer
author_rank: Regular Contributor
timestamp: August 11, 2021, 06:31:58 am
content: I think something may be up with how I'm programming the microcontrollers, as I did a quick test to make sure that the microcotroller was even able to run code by programming it to simply set a pin high withCode:DDRC |= (1 << DDC5);PORTC |= (1 << PORTC5);and it did nothing on that pin. This makes me thing that the code is being programmed incorrectly. The commands I am using to program it are as follows:Code:# Compileavr-gcc main.c -o a.out# Convert to hexavr-objcopy -O ihex a.out a.hex# Write to microcontrollersudo avrdude -c atmelice_isp -p m328p -B 1 -U flash:w:a.hexEDIT1: I should also say that I tested another microcontroller, and it still was not working.

author: Kalcifer
author_rank: Regular Contributor
timestamp: August 11, 2021, 07:01:34 am
content: I have solved it. The issue did turn out to be with how I was programming the microcontroller. Instead ofCode:avr-gcc main.c -o a.outI requiredCode:avr-gcc -mmcu=atmega328p main.c -o a.outI had previously omitted that part of the compile command because I thought that havingCode:#define __AVR_ATmega328P__in the source file meant that I didn't need it, but apparently I still do.
Cost of single user  IAR   AVR  compiler - Page 1
Forum section: electronics / general

author: JoeyG
author_rank: Regular Contributor
timestamp: August 14, 2021, 07:08:17 am
content: any idea of costs would be appreciated

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: August 14, 2021, 08:16:06 am
content: https://www.mouser.com/catalog/catalogusd/645/2360.pdfI think this list may be quite oldISTR Baseline is a code-size limited version

author: voltsandjolts
author_rank: Unknown
timestamp: August 14, 2021, 08:46:28 am
content: If you are starting from scratch, perhaps the excellent and Free avr-gcc might suit you better.If you have IAR code already, maybe consider porting it.https://www.nongnu.org/avr-libc/user-manual/porting.html

author: Psi
author_rank: Super Contributor
timestamp: August 14, 2021, 09:11:58 am
content: You might find the combination of vscode + platformio will get you going on avr with a nice editor and free compiler.
Composite CDC/HID - IADs and need for INF files - Page 1
Forum section: electronics / general

author: 741
author_rank: Frequent Contributor
timestamp: August 10, 2021, 10:30:55 am
content: My aim is to create a PIC-based composite CDC/HID device.Given that HID and CDC are well-known devices and also that (as individual USB devices) no custom driver (INF etc) is asked for - can I use the IAD mechanism to create a composite device that needs no custom driver?

author: magic
author_rank: Super Contributor
timestamp: August 11, 2021, 08:26:41 am
content: Not sure what IAD is, it seems to be something for grouping logically related interfaces together?I'm not exactly world class expert on writing USB descriptors, but isn't it the case that you only need a device descriptor with bDeviceClass=0 (per-interface) and a configuration descriptor specifying two interfaces and two interface descriptors, one each for CDC and HID? Host drivers should bind to each interface separately.LUFA has a demo which includes CDC and a mouse. It's AVR, but descriptors are universal.As for Windows and its USB detection and INF files,I think you could look at the descriptors of any commercial device which works on Windows sans drivers.Chances are you could get more respnose if you moved this to "microcontrollers".

author: ReneK
author_rank: Contributor
timestamp: August 11, 2021, 11:10:03 am
content: As of Windows 10, you don't need a custom INF, regardless if you're using IAD or not.

author: ReneK
author_rank: Contributor
timestamp: August 11, 2021, 11:12:34 am
content: Quote from: magic on August 11, 2021, 08:26:41 amExactly.Quote from: magic on August 11, 2021, 08:26:41 ambDeviceClass = 0xEF (Miscellaneous)bDeviceSubClass = 2 (Common)bDeviceProtocol = 1 (Interface Association Descriptor protocol)

author: Bassman59
author_rank: Super Contributor
timestamp: August 11, 2021, 05:53:58 pm
content: Quote from: magic on August 11, 2021, 08:26:41 am"Interface Association Descriptor." And yep, it's a way to group logically-related interfaces together.Many USB device classes require multiple Interfaces to implement one "Device." Consider audio: it requires a USB Audio Control interface as well as one or more USB Audio Streaming interfaces. All of these interfaces belong to one USB Audio Device.USB CDC also uses more than one Interface. And here is where IADs are important: Say you wanted to implement a Device that had two USB CDC instances. Without IADs, all of the various interfaces for your two CDC things would get combined into one device, so the host wouldn't enumerate it as two devices. The IAD lets you specify basically "these interfaces belong to instance 1 of the device class and those interfaces there belong to instance 2 of that same device class in the same device."
TDS3014B with strange noise - Page 1
Forum section: electronics / general

author: rauldm
author_rank: Regular Contributor
timestamp: August 09, 2021, 07:58:25 pm
content: I have a TDS3014B that shows extrange noise in channel 1 and 2 to 1 V/div, even noise is coupled for example to square waves from waveform generator with 50 ohm impedance or with probe comp signal of oscilloscope througth scope probe. I show a pair of images of oscilloscope without nothing in bnc connectors. Someone has same problem? I have TDS3012B and is not has this problem.
dsPIC33 PWM timer control - Page 1
Forum section: electronics / general

author: perdrix
author_rank: Frequent Contributor
timestamp: August 07, 2021, 03:12:17 pm
content: I'm looking at some code that sets the PWM in free run mode and then has:#define EXEC_FREQ 36000000#define PWM_FREQ 31250P1TPER = (EXEC_FREQ/PWM_FREQ);So P1TPER is set to 1152 which is fine, but what does that mean in terms of the elapsed time before a PWM timer interrupt occurs?ThanksDavid

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 07, 2021, 04:08:08 pm
content: 36MHz/31250 = 1152HzThe interrupt would happen every 1s/1152 = 868uS.Using pwm interrupt is up to you. If you only need free-running pwm, with non critical timing and such, then you can disable it.Otherwise you'll get a big cpu performance hit due the interrupt entering at exiting 1152 times per second.

author: perdrix
author_rank: Frequent Contributor
timestamp: August 07, 2021, 05:23:05 pm
content: Are you sure about that. The docs say:Quotewhich sort of suggests to me that the frequency is related to the inverse of the value.PS don't take this amiss - I'm struggling to interpret what's happening here - where did the magic number in PWM_PREQ come from.PPS Further information PWM Pre-Scale is 1:1 and PWM Post-scale is 16:1

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 07, 2021, 05:41:03 pm
content: Read:http://ww1.microchip.com/downloads/en/devicedoc/70187e.pdfPage 21, 24.QuotePxTMR is just the counter. It increases on each system clock (Or every n cycles if you use prescaler).PxTMR is compared against PxTPER. When matching, PxTMR is resetted and a new PWM cycle starts over.Simple as thatPWM_FREQ defines the desired working frequency. If you have a 36MHz clock source, and want a 31250Hz PWM signal, what is the required divider?36000000/31250Although the formula is slightly wrong, it should be:P1TPER = (EXEC_FREQ/PWM_FREQ)-1;The postscaler, as described there, is to divide the interrupt signals, among other things. Useful for not flooding the cpu with interrupts, instead, do it once every n pwm cycles :Quote
STM32F407 software trigger a one pulse timer using HAL - Page 1
Forum section: electronics / general

author: m10mn
author_rank: Newbie
timestamp: August 03, 2021, 10:25:26 am
content: Hello,I have a question about STM32F407.I was wondering how to software trigger (not external trigger) a "one pulse" timer, using HAL library?Thanks for the help.

author: thm_w
author_rank: Super Contributor
timestamp: August 03, 2021, 09:47:13 pm
content: https://electronics.stackexchange.com/questions/292249/unable-to-initialize-stm32-timer-in-one-pulse-mode-with-st-hal
Having problems getting TinyUSB & STMF105 to work - Page 1
Forum section: electronics / general

author: cmcraeslo
author_rank: Regular Contributor
timestamp: August 03, 2021, 09:19:54 am
content: Hello.I'm a bit confused with tinyusb & the idea behind it. I have problems enumerating the device.I'm trying to ditch the STM32 USB stack because it's a complete mess and it has files all over the place & updating the descriptors, adding composite devices etc is a nightmare.What I'm not completely sure about is which part I need from the HAL_ section to get started. It's a self powered device and VUSB is properly connected to the pins (default STM32 USB example works on the same board), but it seems that some extra stuff needs to be called before the tusb_init() and tusb_task (i'm not running an OS). I tried commenting out the stuff from MX_USB_DEVICE_Init() that is generated by the cube, but I had not had any success with it.Can anyone share a light on how to continue or where to look, I went over a lot of code and can't seem to find anything?Thanks!
Has anyone Made An Arduino Nano USB Duino Coin Miner - Page 1
Forum section: electronics / general

author: Electromouse
author_rank: Newbie
timestamp: June 25, 2021, 07:10:33 pm
content: I saw a guy on YT created some Duco USB miners from an Arduino Nano. The project would be perfect for what I'd like to create but have zero experience in Arduino or coding. Before I shell out some money, do you think an Arduino kit would be a good place to start such as the Elegoo Mega 2560 Kit? Or maybe another kit is worth looking at?Is there anything else I should be looking at first?

author: ajb
author_rank: Super Contributor
timestamp: June 25, 2021, 09:06:37 pm
content: Is this just for fun or are you expecting it to actually accomplish a useful amount of mining?If it's the former, go for it I guess? If it's the latter, you're many many orders of magnitude off in terms of hardware requirements. Exactly how many orders of magnitude depends on the coin, I guess, but considering that some coins are barely worth mining on a high end GPU capable of tens trillions of operations per second at 32 bits(?), and the MCU in an arduino nano is capable of about 20 million operations per second (depending on what the operation is, some instructions are slower than others) at 8 bits, you're off by something like a factor of 40,000,000.EDIT: oh, wait "Duino Coin" is a thing? I thought you were looking to mine one of the more high profile coins that's worth real money. I guess if it's meant to work on an arduino then I guess it should work on any arduino compatible hardware, and probably doesn't require any peripherals so just get whatever looks good or whatever kit comes with what you might need for any future projects, it doesn't seem like it really matters

author: Electromouse
author_rank: Newbie
timestamp: June 25, 2021, 09:13:25 pm
content: It's just for fun, I've got two 7 card rigs running RX 480's so this is just a bit of fun. I liked the idea of the old BTC mining USB's which aren't really any use now but thought a Duco USB would be a fun project.

author: AbbyNormal
author_rank: Newbie
timestamp: August 02, 2021, 02:39:27 am
content: I have 20 nano's mining duco. just fyi

author: james_s
author_rank: Super Contributor
timestamp: August 02, 2021, 05:20:33 am
content: This ridiculous cryptocurrency fad can't end soon enough. Hard to believe such an utterly pointless endeavor is still going on. It's amazing that governments around the world haven't banned them by now just for the absolutely criminal waste of energy and other resources, as much as some smaller countries.
resurecting littlewire  - Page 1
Forum section: electronics / general

author: AnneRanch
author_rank: Contributor
timestamp: August 01, 2021, 12:56:58 am
content: I am trying to brink back to useful life my "little wire" .( To be honest - I have NEVER actually used it !)I started with verifying its existence in my system - lsusbqe@qe-desktop:~$ lsusbBus 002 Device 002: ID 174c:3074 ASMedia Technology Inc. ASM1074 SuperSpeed hubBus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hubBus 001 Device 008: ID 0bc2:2322 Seagate RSS LLC SRD0NF1 Expansion Portable (STEA)Bus 001 Device 005: ID 0bc2:ac23 Seagate RSS LLC BUP Ultra TouchBus 001 Device 006: ID 0a48:3239 I/O Interconnect Multimedia Card ReaderBus 001 Device 003: ID 05e3:0608 Genesys Logic, Inc. HubBus 001 Device 011: ID 046d:c016 Logitech, Inc. Optical Wheel MouseBus 001 Device 010: ID 045e:00f1 Microsoft Corp. Microsoft Wireless Desktop Receiver 3.1ABus 001 Device 009: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)Bus 001 Device 007: ID 1781:0c9f Multiple Vendors USBtinyBus 001 Device 012: ID 0a5c:2121 Broadcom Corp. BCM2210 BluetoothBus 001 Device 004: ID 2001:f103 D-Link Corp. DUB-H7 7-port USB 2.0 hubBus 001 Device 002: ID 174c:2074 ASMedia Technology Inc. ASM1074 High-Speed hubBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubqe@qe-desktop:~$OKthen I did this - per instruction on web siteqe@qe-desktop:~$ avrdude -c usbtiny -p t85 -U flash:w:micronucleus-1.02.hex -U lfuse:w:0xe1:m -U hfuse:w:0x5d:m -U efuse:w:0xfe:mavrdude: initialization failed, rc=-1Double check connections and try again, or use -F to overridethis check.avrdude done. Thank you.then this - adding -F optionqe@qe-desktop:~$ avrdude -c usbtiny -p t85 -U flash:w:micronucleus-1.02.hex -U lfuse:w:0xe1:m -U hfuse:w:0x5d:m -U efuse:w:0xfe:m -Favrdude: initialization failed, rc=-1avrdude: AVR device initialized and ready to accept instructionsavrdude: Device signature = 0xe1cc0bavrdude: Expected signature for ATtiny85 is 1E 93 0Bavrdude: NOTE: "flash" memory has been specified, an erase cycle will be performedTo disable this feature, specify the -D option.avrdude done. Thank you.Since I have no clue what are all the options in "avrdude" command I assume that I need to change the "signature".Can anybody suggest how ?Thanks

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 01, 2021, 01:50:25 am
content: 10-second google search:https://forum.arduino.cc/t/solved-avrdude-initialization-failed-rc-1/242036
problem in string.h lib in codevision - Page 1
Forum section: electronics / general

author: tariq
author_rank: Contributor
timestamp: July 29, 2021, 07:46:30 pm
content: hiI'm using codevision AVR. in string.h lib when one of the arrays is const an error occurs.for example i want to put a array of string from one array to another like this :unsigned char A;const unsigned char B={"HELLOWORLD"};when i use strncpy like this:strncpy(A,B,10);i have this errorError:, #included from: main.c: function argument #2 of type 'flash unsigned char ' is incompatible with required parameter of type 'unsigned char *'and this is the same for all of string.h lib functions.in ARM and keil compiler i didn't had this problem but in codevision error occurs.i know i can use for loop but is there any way to avoid this error?

author: richmit
author_rank: Contributor
timestamp: July 29, 2021, 09:02:34 pm
content: This might help:https://www.avrfreaks.net/forum/strcpy-and-strcat-flash

author: esepecesito
author_rank: Regular Contributor
timestamp: July 30, 2021, 05:16:37 pm
content: When you made the constant, it will be placed in ROM (flash). The library seems not to be able to copy from flash to RAM.I do not know what you are trying to do, to help with a workaround for it.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: July 30, 2021, 05:48:09 pm
content: strncpy_P
Raspberry vs microcontroller as master for multinode system by CAN bus FD. - Page 1
Forum section: electronics / general

author: luiHS
author_rank: Frequent Contributor
timestamp: July 28, 2021, 10:29:17 am
content: Hi.I have to do a design of a system with nodes (master, slaves), I have decided to use CAN Bus FD.In this design I need to play videos, so I am going to use a Raspberry pi 4 for these tasks, I have not yet decided if it will be a CM4 because the two 100-pin connectors have a very fine pitch.There will be a master and at least 5 or 6 slave nodes, all must respond to the master's commands instantly, there can be no lag.All nodes will work with NXP RT1064 microcontrollers (Cortex M7 600Mhz), and as master I was also planning to use the same microcontroller or an RT1171 (Cortex M7 1Ghz). The master communicates with the Raspberry by serial port to send it commands with which to play videos and output texts and data on the screen.My question now is if I could do without the microcontroller in the master and let the Raspberry manage it all by communicating with the slave nodes via CAN bus FD using an MCP2517 or MCP2518.What worries me is that the Raspberry causes some kind of lag when processing CAN bus communications, since it does not have this bus, it has to be implemented with an SPI controller, such as the aforementioned MCP2517 or MCP2518.

author: Siwastaja
author_rank: Super Contributor
timestamp: July 28, 2021, 11:38:50 am
content: Of course the Raspberry, by running standard Linux, has non-deterministic timing and lag easily in tens of ms, and worst-case lag in seconds (or of course it can completely crash), but adding another layer does not solve this. If the Raspberry does something based on messages on CAN, or generates messages on CAN, what can you do except accept the lag?If you can use the intermediate microcontoller to performsome partof the tasks Raspberry would otherwise need to do, specifically all the timing critical ones,withoutthe Raspberry, then it would make sense to add that layer. Otherwise, I don't see the point.The usual SPI CAN bridges have some buffer memory, like 2KB, and this should handle the delays of linux kernel in 99.9999% of cases but be aware that using linux, it's impossible to absolutely guarantee the timing so buffer overrun is always a theoretical possibility, but I think adding another excess layer just to add more buffer memory is more risky bug-wise.Likely, the SPI-based CAN controller directly on the Raspberry SoCs SPI, using the kernel driver module, is quite fast and reliable. I don't think you can do any better with any other interface on the Raspi.
STM32F0 USB interface - Page 1
Forum section: electronics / general

author: Red_Micro
author_rank: Regular Contributor
timestamp: July 16, 2021, 04:59:29 pm
content: Anyone with experience using the crystal less USB interface from STM32F072? I have no external crystal. I've seen some unstable communication, sometimes disconnecting and connecting back multiple times fix it. I will start debugging so any suggestion is welcome. I read this from the errata sheet, which could be checked.Quote

author: pigrew
author_rank: Frequent Contributor
timestamp: July 20, 2021, 05:39:16 pm
content: Run optimized code, sometimes debugging/unoptimized code causes latency to be too high for USB.Verify mechanicals and schematic. Do you have too much series resistance on D+/D-? Is Vdd dropping out? Too much capacitance on the data lines? Bad solder joints?A photo of your PCB (and perhaps schematic) could also help.

author: lbthomsen
author_rank: Newbie
timestamp: July 24, 2021, 01:28:21 am
content: I have not tried crystal less USB on the STM32F072 (does that even exist or do you mean STM32L072?), but I have done this using an STM32L432 and that works flawlessly.//Lars...

author: GromBeestje
author_rank: Frequent Contributor
timestamp: July 24, 2021, 10:25:15 pm
content: Did you enable Automatic Clock Trimming?

author: teletypeguy
author_rank: Contributor
timestamp: July 28, 2021, 05:54:47 am
content: I have not used internal oscillator for usb, though as grombeestje pointed out, clock trimming is likely important. I am interested how that works out.What kind of device does it enumerate as, and what kind of data rate?I have used many 072 and 042 parts as usb hid devices, though with an 8meg xtal. Never a glitch on the streaming data -- well, until the test house clamped a sleeve around the cable for hv pulse immunity testing -- it didn't like thatLayout could affect it if you don't have a short-ish/straight-ish 90-ohm diff pair, smooth transitions to the series resistors... A tvs should be a must, and a common-mode choke is a decent addition. I had pll spurs to knock down and found that 47pF from each trace to ground fixed that without affecting data.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: July 28, 2021, 10:03:51 pm
content: Quote from: Red_Micro on July 16, 2021, 04:59:29 pmI've not used that part, but they all have a largely common approach of a 1ms based DFLL.You could try with a crystal, and confirm the problems go away - that confirms it is not any SW related issue.You could output the divided OSC to a pin, and put a counter on that - a 1ms pin toggle is likely to match any DPLL update rate, as they use USB SOF as the locking clock.You should see that lock, when USB is connected and the SW operates correctly.The lock granularity will be limited by the LSB of the trim steps, but the frequency should jitter about a long term average of the PC clock.
GL823 side components - Page 1
Forum section: electronics / general

author: remopong
author_rank: Contributor
timestamp: July 25, 2021, 02:15:28 pm
content: Hi, I'm currently working on a big project and I'm trying to use the GL823 CARD READER chip. I wired everything as it should be but my problem is that even if the card reader is detected, the micro sd soldered to it, isn't... I saw somewhere I should maybe place some capacitors, from VCC to VSS but, what capacity and where could I find a document that tells me how to make it work ? Thanks
Dumping flash memory ft2232h - Page 1
Forum section: electronics / general

author: t4rmo
author_rank: Contributor
timestamp: July 23, 2021, 11:19:14 am
content: I tried to read the memory's flash content with my ft2232h.I wrote a script to emulate the read's chronogram with pyftdi but i haven't able to communicate with the flash.(I don't receive flash's response)Any idea of what happen?Code:from pyftdi.spi import *fd = open('dump','wb')spi = SpiController()spi.configure('ftdi://ftdi:2232:2:7/1')slave = spi.get_port(cs=0,freq = 10E6)address = b'\x00\x00\x00'read_command = b'\x03'release_deep_power = b'\xAB'slave.write(release_deep_power)slave.write(read_command + address)while 1:data_out=slave.read(1)fd.write(data_out)In theory with a single read instruction you can dump the whole memory due to a internal counter

author: abyrvalg
author_rank: Frequent Contributor
timestamp: July 23, 2021, 01:00:54 pm
content: According to PyFTDI SPI documentationhttps://eblot.github.io/pyftdi/api/spi.html#pyftdi.spi.SpiPort.writeboth write() and read() assert nCS at start and deassert at the end of transfer by default, so you have a broken nCS sequence. Try this:Code:FLASH_SIZE = 0x100000 #put your size hereslave.write(read_command + address, start=True, stop=False) #assert nCS and keep it assertedfor i in range(FLASH_SIZE-1):data_out=slave.read(1, start=False, stop=False) # don't touch nCSfd.write(data_out)data_out=slave.read(1, start=False, stop=True) #read last byte and deassert nCS, terminating the operationfd.write(data_out)

author: t4rmo
author_rank: Contributor
timestamp: July 24, 2021, 10:11:49 am
content: Thank you abyrvalg, you are rightNow I'm going to try the writingRegards
Curious research: "Plastic" micros using TFT fab processes - Page 1
Forum section: electronics / general

author: Whales
author_rank: Super Contributor
timestamp: July 23, 2021, 12:22:30 am
content: Just a curiosity: research level, only runs at KHz and doesn't have all memory onboard.Summary and images:https://www.cnx-software.com/2021/07/22/plasticarm-is-a-functional-non-silicon-flexible-cortex-m0-microcontroller/Paper itself (seems open to download):https://www.nature.com/articles/s41586-021-03625-wCurious takeaway: TFT fabrication processes (ie those used to make LCD screens) instead used to fab a microcontroller. Completely different substrate, authors claim it's much cheaper.Normally I would assume that the packaging & distribution costs of small micros is their dominant cost (not wafer+fab), but given the current shortages of certain models of small micro it might be worthwhile having a future where micros are fabbed on a wider variety of crazy processes.

author: ataradov
author_rank: Super Contributor
timestamp: July 23, 2021, 02:38:32 am
content: I don't see why it would be cheaper. Especially when specs are a bit closer to something usable.We already have 3 cent MCUs that are much faster than this.I also don't buy eco angle. The piece of silicon is just sand in the end, plastic packaging is a bit worse, but if we assume non user friendly package, then we can go with WLCSP and avid the plastic in a traditional process.It is an interesting proof of concept, for sure, but I would not extrapolate too much.

author: coppice
author_rank: Super Contributor
timestamp: July 23, 2021, 05:28:01 am
content: In an era when the die for a small MCU costs less than the packaging and testing to turn it into a usable component, its hard to see how reducing the cost of the actual circuitry can do much for overall costs.

author: Whales
author_rank: Super Contributor
timestamp: July 24, 2021, 04:23:29 am
content: Quote from: coppice on July 23, 2021, 05:28:01 amNot at the moment, not everyone can get fab time.

author: ataradov
author_rank: Super Contributor
timestamp: July 24, 2021, 04:44:31 am
content: Sure, but what makes you think that there will be fab time with a weird TFT on plastic process if it gets mass adoption? They will be in the same exact situation.
MPLAB Code Coverage  - Page 1
Forum section: electronics / general

author: ricko_uk
author_rank: Super Contributor
timestamp: July 16, 2021, 10:50:08 am
content: Hi,I have been looking into MPLAB Code Coverage but it is not clear if it is possible to do the following:- line by line "replay" of the C source code (XC32 compiler) not of the assembly, that has been executed- have the source code that has been executed highlighted so you can quickly go through it and see what has been executed instead of having to look at the executed code mapsIt would seem basic obvious functionality but I could not find any videos or documents showing that clearly. Most of the videos go on about the maps instead of a clear visual and/or replay as described above. Does anybody know?Thank you

author: ivonenand
author_rank: Contributor
timestamp: July 23, 2021, 02:19:37 pm
content: Though I don't have an answer for your specific question, I would just like to advise you to double check the qualification of the tool to make sure it's applicable to your product. It says that it's TUV-SUD certified, but that is only valid in certain types of industries. For example in aerospace, the TUV-SUD is useless and you would have to qualify the tool yourself.Ivo

author: ricko_uk
author_rank: Super Contributor
timestamp: July 23, 2021, 06:01:23 pm
content: Thank you Ivo, useful info!In this case I just need it for myself to speed up checking code.