hybridfree/eevblog-posts huggingface dataset:
peripherals do not match pcb connections? - Page 1
Forum section: electronics / general

author: vidicon
author_rank: Newbie
timestamp: July 16, 2017, 09:14:43 pm
content: A while back someone crashed a cheap drone in my grandma's yard. After nobody came to retrieve it she gave it to me. With no remote, it was quite useless. but after opening it I saw that it had hack potential.The PCB.I have been able to program the microcontroller (the GD32F130C8T6 from GigaDevice) with keil and a ST-LINK/V2but when I was looking at implementing the communication to the NRF24 using SPI something just didn't add up. the SPI pins on the NRF24 and the SPI pins on the GD32 do not match. the same go`s for I²C for the gyro.TLDR:the peripheral pins do not match the connections. Do I overlook someting or do I have to bit-bang this?Datasheets:GD32F130C8T6:LinkNRF24:LinkP.S.Does someone recognises this chip? Google only results in color codes. I think it is an accelerometer or magnetometerthe numbers are:3253B04B315D519C1

author: ataradov
author_rank: Super Contributor
timestamp: July 16, 2017, 09:37:24 pm
content: They are probably just bit-banging SPI. It is not like this thing is super fast anyway.

author: ajb
author_rank: Super Contributor
timestamp: July 17, 2017, 11:30:16 am
content: It's not uncommon to have options to swap pin functions within peripherals, have you looked for such options in the peripheral configuration? Your datasheet link doesn't work, and the datasheet google turned up doesn't show any configuration or usage info.

author: mikerj
author_rank: Super Contributor
timestamp: July 17, 2017, 01:50:03 pm
content: Datasheets and User manuals for the GigaDevices parts arehere.The datasheet is a little confusing. The pinout chart suggests that for a GD32F130x8 device, pins 26,27 and 28 are used for the SPI2 peripheral. SPI1 can use pins 15,16,17 or 36,40,41 for SCK, MISO and MOSI respectively.It's possible they have routed traces from one of the SPI1 configurations under the device and out through the SPI2 pins, which are then tri-stated in the code. This would simplify routing if the board is only double sided, and would be easy to check with a simple continuity test. It seems ridiculous to bit bang this when you have two perfectly good SPI peripherals available, which can use DMA etc.
Do I get this timing chart right ? - Page 1
Forum section: electronics / general

author: Back2Volts
author_rank: Unknown
timestamp: July 17, 2017, 12:38:06 am
content: I need help with this timing chart from the ST7735 datasheet. It is the timing for the bi-dir SPI + data/command line configuration. My concern is with the D/CX signal line. I am correct understanding that the driver reads the D/CX during the first clock period for the byte, that is the first bit being sent, and it does not care for its level for the rest of the byte ?I will appreciate your commentsTony

author: Back2Volts
author_rank: Unknown
timestamp: July 17, 2017, 01:13:08 am
content: Based on this entry I found I may be wrong:https://users.ece.utexas.edu/~valvano/arm/ST7735.c// The Data/Command pin must be valid when the eighth bit is// sent.

author: Bruce Abbott
author_rank: Frequent Contributor
timestamp: July 17, 2017, 02:46:06 am
content: That code sends the data in parallel to a hardware serializer, so it has no choice but to set D/CX for the entire period (even if the ST7735 does not require it).According to figure 9.3.3, D/CX must be valid during thelastbit of each byte.

author: Back2Volts
author_rank: Unknown
timestamp: July 17, 2017, 04:16:06 am
content: Bruce, thank you. I should have kept reading looking for more details. Right around the picture you posted there is some text indicating DCX is sampled on the edge of the eighth SCLK cycle.Tony
Any READABLE example of USB code for STM32F0xx or equivalent... ? - Page 1
Forum section: electronics / general

author: L1L1
author_rank: Regular Contributor
timestamp: July 14, 2017, 06:34:16 am
content: Hi folks,I've been programming Cortex-M0 chips for the past year in C, mainly STM32F0xx and SAMD21.As part of learning how to use these microcontrollers, at first I like to skip using the HAL libraries provided by manufacturers and program registers directly. I often read the actual code of the manufacturer HAL libraries and compare it with the docs, before writing my own "simplified" version of these functions.I've happily applied this approach to GPIO, ADC, Interrupts, CANbus, I2C, SPI, etc. But I haven't manage to extend it to USB, for example for USB CDC serial implementation. The manufacturer libraries are a mess of abstraction with layers of callbacks. The documentation is usually unclear.Does anyone know of a simple example of USB code (preferably for CDC) for the STM32F0xx, SAMD21 or some relative? Something that a human can read?Regards, Alain

author: ataradov
author_rank: Super Contributor
timestamp: July 14, 2017, 06:43:47 am
content: HID for SAM D21 -https://github.com/ataradov/dgw/tree/master/embeddedCDC is coming in the next few days, I'm working on it at the moment.

author: L1L1
author_rank: Regular Contributor
timestamp: July 16, 2017, 06:39:29 am
content: Quote from: ataradov on July 14, 2017, 06:43:47 amMany thanks! I started looking through your code: so far it seems much easier to follow than other stuff I'd seen previously.

author: ataradov
author_rank: Super Contributor
timestamp: July 16, 2017, 06:42:12 am
content: Here is CDC for D11 -https://github.com/ataradov/vcp. It will work on D21 with minor effort as well.The code is pretty minimal. USB peripherals in most MCUs suck, since they are designed by hardware people, who have no clue about programming.PS: It was just finished, so bugs are quite possible.

author: westfw
author_rank: Super Contributor
timestamp: July 16, 2017, 10:30:46 pm
content: Nice. I've bought a couple ofhttps://hackaday.io/project/10210-dixi-arduino-sam-d11-usb-stickand have been a bit depressed because the Arduino support is so bloated (9k for Blink, including the CDC code, out of 12k available post-bootloader. Most of that is the CDC implementation.)
DIP based USB interface IC for FPGA/CPLD in-system programming - Page 1
Forum section: electronics / general

author: garvind25
author_rank: Regular Contributor
timestamp: July 13, 2017, 09:03:27 am
content: Hi,I wanted to program a FPGA/CPLD through USB interface. Since these PLDs have JTAG interface, does anyone know of any DIP IC which can be used for in-system programming of these PLDs? I know of FT232 ICs but these seem to be available in SMD packages.Thanking You,Arvind Gupta

author: alm
author_rank: Super Contributor
timestamp: July 13, 2017, 09:13:16 am
content: Not off the shelf, but there are some PICs with USB support that are available in DIP. You would have to emulate something that is compatible with UrJTAG or whatever you are using.I am sure you can get FT232 on a breakout board for a few USD. That might be a DIP-like form-factor that might work for you.

author: hli
author_rank: Frequent Contributor
timestamp: July 14, 2017, 09:02:26 pm
content: For Altera chips there is anUSB blaster clonewith PICs. Build myself one with a DIP chip (although I did not test it with Altera chips, but was using it with OpenOCD...)

author: abraxa
author_rank: Frequent Contributor
timestamp: July 14, 2017, 10:12:39 pm
content: You could also use an Atmega with V-USB.
I2C on MSP430 - Page 1
Forum section: electronics / general

author: kubuni
author_rank: Newbie
timestamp: July 10, 2017, 06:56:50 pm
content: Hello,I am new to implementing I2C on my own; furthermore, I am doing this for an SSD1306 OLED module. which I already tested with the arduino.Reading from the MSP430 Family User Guide, I want my MCU (msp430g2553) in master mode by UCMODEx = 11 and UCA10 = 0 for 7 bit addressing.What I'm a little lost is setting the address. I know you have to set it for the register UCB0SA, but do I had the R/W as well to it? The address I used for 0x3C. so, I don't know if I just chug that in there.Also, Would I just be fine using the MCLK at full speed? any suggestions for a rule of thumb for delays on sending a command?thanks!

author: Unknown
author_rank: Unknown
timestamp: July 11, 2017, 05:46:39 am
content: I would take a look at TI'sSLAA382A documentwith itsassociated example code. I think the document combined with the code will probably answer a lot of the questions.Not sure what you mean by delays between commands? Generally you either poll the registers or use interrupts to determine when the send or receive operation is complete.
Characteristics to measure to detect presence / absence of tri-state device - Page 1
Forum section: electronics / general

author: rbm
author_rank: Regular Contributor
timestamp: July 10, 2017, 06:38:43 pm
content: The EEVacademy #3 video that was released last week was very opportune for me because I learnt some things about the MicroChips PIC processor which I didn't know before. It was interesting to see the electrical construction of the RA4 interface that Dave2 presented.I'm facing a problem for which I haven't got a suitable solution. So, I'm hoping to get help from others who are better versed in MicroChips PICs than I.My problem is I have a system which may or may not have a PIC microcontroller present, based on whether a daughter card is installed. I need to electrically test for the presence or absence of this microcontroller only by testing characteristics presented to me over pins that are brought out to the card connector from the on-board UART serial interface (because this is the only I/O interface presented to me).In Dave's video, he mentioned the tri-state characteristics of the PIC I/O - that is, the P-channel FET is on when the line is active low, the N-channel FET is on when the line is active high, and the line is high impedance when inactive. I am trying to come up with ways to passively test for these characteristics. Is it possible?

author: suicidaleggroll
author_rank: Super Contributor
timestamp: July 10, 2017, 06:51:23 pm
content: You have a UART, UART idles high. If you add a weak pulldown resistor on your Rx line (the PIC's Tx), you can see if the line is reading high or low. Low = no UART Tx is attached to that line, High = one is (maybe).

author: rbm
author_rank: Regular Contributor
timestamp: July 11, 2017, 01:04:22 am
content: Thank you. I'll try this.
RTOS timing - Page 1
Forum section: electronics / general

author: gogoman
author_rank: Regular Contributor
timestamp: June 30, 2017, 04:21:42 am
content: Hi new to this subject, forgive the obvious.In a multi thread application where thread 1 is called every 30us (highest priority, 3us completion), thread 2 called every 100us, 500us to complete , and thread 3 called every 1 ms 100us to complete.A general explanation would be helpful.btw The processor clk is 100 mhz,thanks

author: Sal Ammoniac
author_rank: Super Contributor
timestamp: June 30, 2017, 04:31:54 am
content: Well, thread 2 is a problem because it's getting called every 100us, but it takes 500us to complete. What exactly are you looking for here?

author: Brianf
author_rank: Regular Contributor
timestamp: June 30, 2017, 06:14:26 am
content: What overhead does your RTOS have when thread switching?How much jitter can you tolerate on your thread's start times?

author: Kjelt
author_rank: Super Contributor
timestamp: June 30, 2017, 07:26:38 am
content: Google for "Rate Monotonic Analysis" and study the basics.

author: MosherIV
author_rank: Super Contributor
timestamp: June 30, 2017, 08:30:01 am
content: QuoteI do no think that is how RTOS scheduling works.Generally, RTOS task scheduling is pre-emptive round robin with priorities.That means every task is given the same length of time slot to run before the next one is scheduled in.There is a level based priority system, the highest priority tasks get scheduled before the lower ones.All task run until suspension or completion or they get put back on the suspended task list waiting for their next time slot.The scheduler in some RTOS can be set to run in co-operative mode, that is tasks run until suspension or completion and then the next task is scheduled.Again, this can be done with task priorities.Hope this helps.

author: mikerj
author_rank: Super Contributor
timestamp: June 30, 2017, 12:48:21 pm
content: Quote from: gogoman on June 30, 2017, 04:21:42 amYou haven't actually asked us a question, what exactly do you want to know?

author: gogoman
author_rank: Regular Contributor
timestamp: July 06, 2017, 05:22:26 am
content: thanks for the info.
Generic mono GLCD library - Page 1
Forum section: electronics / general

author: Harvs
author_rank: Super Contributor
timestamp: July 01, 2017, 11:01:16 pm
content: I'm currently interfacing a 128x64 mono LCD to a new micro (ESP32 in this case.)Does anyone know of a good generic library in C to do all the basic graphic stuff (sprites, fonts, lines, rectangles etc...)I was thinking if there was a library that could do the graphics stuff into a RAM buffer, then I just dump that out to the display when I've finished an update (DMA and 20MHz SPI makes this an almost zero overhead operation.)I'm looking for a generic approach that I could re-use on various projects (only with 32bit MCUs with plenty of RAM) with different mono displays of varying resolution.Thanks

author: Nusa
author_rank: Super Contributor
timestamp: July 01, 2017, 11:08:58 pm
content: https://www.google.com/search?q=esp32+graphics+library

author: Harvs
author_rank: Super Contributor
timestamp: July 01, 2017, 11:45:25 pm
content: Quote from: Nusa on July 01, 2017, 11:08:58 pmYes I can use google and find a myriad of often half baked libraries tied to platforms and specific LCDs...But...QuoteYes I could spend the time to deconstruct someones Arduino library or write my own, and maybe I will.However, if someone actually has a recommendation for a good quality library that meets a generic mcu and display independant approach I'm all for it (I'm thinking like Chan's FATFS library.)

author: JanJansen
author_rank: Frequent Contributor
timestamp: July 02, 2017, 03:44:16 pm
content: http://www.microchip.com/forums/m966941.aspx

author: macboy
author_rank: Super Contributor
timestamp: July 09, 2017, 01:14:24 pm
content: u8g2 might be interesting to you. It is designed to be lightweight enough for 8 bitters but works just as well on 16 and 32b also.
"High" speed WiFi module for a Microcontroller - Page 1
Forum section: electronics / general

author: ivonenand
author_rank: Contributor
timestamp: June 30, 2017, 11:00:53 am
content: Hi guys,I need to connect a microcontroller (an STM32F7) to WiFI (b/g/n) and send some TCP packets to a known server. The thing is, I need the communication to the server to be "high" speed, about 2-4 MBit/s of binary data. I've looked for some small WiFi modules (some ESP8266 based, some based on M3/M4 micros) and they all communicate with UART and AT commands. The AT commands are great, but if you need to throughput data at higher speeds it becomes a problem (especially with the limited speed of the Uart). Does anyone have any experiences with connections like these? Does anyone know any modules that can communicate via SPI (10MHz or above)? From what I have seen, any high speed modules use USB 2.0 connection to the host, but that's not an option for me and my F7 microcontroller (especially since there is probably no USB driver documentation).Any input would be very appreciated,Regards,Ivo

author: sleemanj
author_rank: Super Contributor
timestamp: June 30, 2017, 11:21:20 am
content: ESP8266 and ESP32 both can do SPI slave (and Master), I have no idea about specs or anything else other than they have that ability.In fact here's an EEVBlog thread about ESP8266 SPIhttps://www.eevblog.com/forum/microcontrollers/esp8266-native-spi-hardware-driver/

author: testian
author_rank: Regular Contributor
timestamp: July 01, 2017, 09:02:40 pm
content: The ESP32 should be able to handle this. (https://mobile.twitter.com/gmag12/status/837263831873257473/photo/1)Herehttps://github.com/espressif/esp-idf/issues/390has somebody sent data with 15Mbps and the SPI can operate up to 80 MHz. (http://espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf)

author: technix
author_rank: Super Contributor
timestamp: July 03, 2017, 01:15:37 am
content: You can use Wi-Fi modules that connects to your system over SDIO, but driving them can be troublesome as they usually expect some kind of OS involved.Or you can use a COTS wireless access point in station mode to convert the Wi-Fi connection to a wired one, and use native Ethernet on the STM32F7 chip through a PHY chip and the RMII interface.

author: Gustav
author_rank: Newbie
timestamp: July 03, 2017, 06:20:50 pm
content: I am currently working on a project where i am using the Ampak AP6216 which you can get cheap from china.It is using the Broadcom/Cypress BCM43438, and they deliver a library for STM32 MCU in the WICED sdk i am still working on the PCB so i don't know how hard it is to work with.It is also used in a lot of single board computers so you can find schematics for the design.

author: NorthGuy
author_rank: Super Contributor
timestamp: July 03, 2017, 09:08:09 pm
content: I don't know about the module, but 4Mb/s is not a problem for UART.
rotary encoder in c (stm32) - Page 1
Forum section: electronics / general

author: m0p
author_rank: Newbie
timestamp: July 03, 2017, 07:51:26 am
content: Hi!Im trying to get a rotary encoder working but its just to advanced for me...This is the code i tried to write but its not the right way to do it...And i just dont know how to think...Can someone help me in the right direction here?Code:int rot = (0x0000);while(1){if (!GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_1)){rot = 1;rot<<=1;}if (!GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_2)){rot = rot + 1;rot<<=1;}if (!GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_1)){rot = rot + 1;rot<<=1;}if (!GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_2)){rot = rot + 1;rot<<=1;}if (rot == 1 || rot == 7 || rot == 8 || rot == 14){a = a + 34360;}if (rot == 2 || rot == 7 || rot == 8 || rot == 14){a = a - 34360;}rot = 0;}

author: voltsandjolts
author_rank: Unknown
timestamp: July 03, 2017, 07:55:46 am
content: Welcome to the forum.This topic has been discussed quite a lot. You can use the google search term "rotary encoder site:eevblog.com" if you don't like the forum built-in search.Example:https://www.eevblog.com/forum/projects/easy-rotary-encoder-implementation-good-easy-to-implement-code/

author: MarkF
author_rank: Super Contributor
timestamp: July 03, 2017, 09:13:58 am
content: I used the attached application note for PEC11 encoders with their suggested pull-up and filter shown in the datasheet. The assembly code in the app note can be accomplished with just a few lines of C code.
Looking for STM32W108 demo - Page 1
Forum section: electronics / general

author: vsboost
author_rank: Contributor
timestamp: June 29, 2017, 05:18:03 am
content: Hi all,Was wondering if anybody has STM32W108ate_demo or STM32W108 watchdog files, in particular everything under the Tools directory.Have found ithttps://www.ecsdn.com/d-8yFD.htmlandhttp://en.pudn.com/downloads489/sourcecode/embedded/detail2039901_en.htmlBut those are those chineese sites that want money or upload 5 files for a point but when you do upload files nothing happens.Will be greatly appreciated.Cheers

author: mrm2007
author_rank: Contributor
timestamp: June 29, 2017, 11:02:54 am
content: If you want STM32W ZIGBEE Check thishttp://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32-standard-peripheral-libraries-expansions/stsw-stm32038.htmlUpdate: If you want the pudn file,this is it :https://app.box.com/s/fgxm5reg53tfi3nqogik50vitxspyxgnSent from my E2333 using Tapatalk

author: vsboost
author_rank: Contributor
timestamp: June 29, 2017, 11:05:39 am
content: Hey mrm2007,If you could download it, it would be great.Thanks again

author: mrm2007
author_rank: Contributor
timestamp: June 29, 2017, 11:14:57 am
content: Hi, updated the previous post:https://app.box.com/s/fgxm5reg53tfi3nqogik50vitxspyxgnSent from my E2333 using Tapatalk

author: vsboost
author_rank: Contributor
timestamp: June 29, 2017, 11:20:58 am
content: Thank you mrm2007Truly is appreciated.
FPGA Z8 Encore Project - Page 1
Forum section: electronics / general

author: rstofer
author_rank: Super Contributor
timestamp: June 28, 2017, 02:54:11 pm
content: The July 2017 edition of Nuts and Volts magazine has an article re: creating an FPGA CPU similar to the Zilog Z8 Encore device.Although the Z8 instruction set is similar to the Z80, the architecture is entirely different. Among other things, the design is based on a Harvard architecture with separate program and data memory areas. This is important because it allows the FPGA version to queue up instruction bytes (8 byte queue) such that all 4 bytes of long instructions are likely to be immediately available rather than having to fetch on demand.Code for the CPU can be written using Zilog's free toolchain which includes an assembler and C compiler.The FPGA is based on an Altera miniboard:http://www.ebay.com/itm/Altera-EP4CE6E22C8N-Mini-FPGA-Board-Cyclone-IV/112023254939This might be a very nice advanced beginner project.It's important to understand that the Z8 is not a Z80, the Z8 is more like an advanced PIC or ATmega. It has a bunch of peripherals internal to the chip so it isn't just a stand-alone CPU.

author: Unknown
author_rank: Unknown
timestamp: June 29, 2017, 02:50:35 am
content: Very neat!I still use the Z8 Encore XP as well as eZ80, occasionally. It was my second microcontroller after PIC, and I think they are still decent chips today although the software libraries are not as extensive as some other manufacturers. Sort of amazing that Zilog is still around after all these years, but apparently they are big into alarm sensor products? (Motion detectors, etc.)
Low Power MCU vs LiPo Self-Discharge - Page 1
Forum section: electronics / general

author: colorado.rob
author_rank: Frequent Contributor
timestamp: June 28, 2017, 09:18:37 pm
content: At what point does the self-discharge rate of a LiPo battery exceed the low power current of an MCU? Put another way, when using rechargeable LiPo batteries, at what point does the current draw in the circuit become immaterial? I'm down to a sleep current for my board in the 2-3uA range when powered off. For my 900mAh battery, that's good for 300000 hours, 12500 days or 35 years. There's no way the battery will last that long.What's the prudent cut off point?BTW, the quoted self-discharge rates for LiPo batteries I've seen are way overstated. I've got similar boards on my shelf that have been "asleep" for 4 years that still show close to 4V on the 3.7V battery. Full charge was 4.2V.

author: retrolefty
author_rank: Super Contributor
timestamp: June 28, 2017, 09:38:43 pm
content: Well from a quick goggle search:QuoteThat's a start so take your battery mAH rating and do the math to get a rough idea. You may need to get a datasheet for your specific battery pack to get more accurate estimate.Good luck
DAC outputs on Arduino Due not working... - Page 1
Forum section: electronics / general

author: Boscoe
author_rank: Frequent Contributor
timestamp: June 27, 2017, 10:42:17 am
content: Hi all,Something that I though would be easy to do, output values on the DAC, is proving very frustrating. I have the same issue on two Arduino Due boards. Whatever code I try from examples the outputs are always high impedance.I've tried setting the DAC pins as outputs or nothing, changing the resolution etc. One issue I found online was to do with writing to the DACs too quickly however I only write it once. Both DAC outputs suffer from the issue.Any advice would be great!Thanks.Some code:Code:void setup() {pinMode(DAC0, OUTPUT);analogWriteResolution(12);analogWrite(DAC0, 2048);}void loop() {if(digitalRead(SW_START) == 1){enableDischarge(4);}else{disableDischarge(4);}delay(1000);}

author: sokoloff
author_rank: Super Contributor
timestamp: June 27, 2017, 11:08:45 am
content: Have you tried pulling the analogWrite statement into the loop()?Have you tried a simpler, 8-bit DAC code?Code:void setup() {// initialize the digital pin as an output.pinMode(5, OUTPUT);}void loop() {analogWrite(5,127); //Set the PWM at 50 % on digital pin 5}Or other code examples:https://www.arduino.cc/en/Reference/AnalogWriteResolution

author: Boscoe
author_rank: Frequent Contributor
timestamp: June 27, 2017, 11:36:27 am
content: Quote from: sokoloff on June 27, 2017, 11:08:45 amI copied and pasted your code however changed the pin to 35 - but get nothing on the output

author: Rerouter
author_rank: Super Contributor
timestamp: June 27, 2017, 12:56:09 pm
content: try removing the pin definition, arm peripherals have far more features than you would expect on them, so it may be that its both outputtting on the dac, and outputting a 0 to the pin, thus grounding that outputfor more references, see herehttps://forum.arduino.cc/index.php?topic=154965.0
Lattice ECP5 and ECP5-5G: Connectivity & Co-Processing - Special Offer - Page 1
Forum section: electronics / general

author: Scrts
author_rank: Frequent Contributor
timestamp: June 26, 2017, 06:03:48 pm
content: Saw this on twitter today:http://www.latticesemi.com/ECP5promoSeems like a good price for the stuff included. I am not related to Lattice and in general I am Altera guy
microcontroller with sleep status output? - Page 1
Forum section: electronics / general

author: NiHaoMike
author_rank: Super Contributor
timestamp: June 26, 2017, 03:35:49 am
content: Are there any microcontrollers with a sleep status output? In other words, the capability to set a GPIO output a logic level depending on whether the microcontroller is in sleep or in active mode, set by hardware? The main advantage I see is that for applications where the microcontroller goes to sleep often and is usually in the active state for a very short time, external peripherals (e.g. sensors) can start powering on a little sooner and reduce the active time needed. And be immune to strange bugs from forgetting to set a GPIO on entering or exiting sleep.

author: BrianHG
author_rank: Super Contributor
timestamp: June 26, 2017, 04:22:04 am
content: Bug in code not being able to set an IO before and after the sleep command? Wouldn't this would be an impossibly difficult bug to create?As for minimal advance powering up signal for external hardware, why not put the MCU into sleep in 32KHz ultra low power mode, then when waking up, in 32KHz, set the IO on and wait that infinitesimal small delay before changing the MCU clock back to full speed as a means of minimizing power consumption?

author: NiHaoMike
author_rank: Super Contributor
timestamp: June 26, 2017, 04:34:05 am
content: It's more for curiosity than a real need. As for how to forget to set a GPIO, maybe there's a time after initial development where there's a need to add another ISR and the requirement to set the GPIO is forgotten.

author: Alex Eisenhut
author_rank: Super Contributor
timestamp: June 26, 2017, 04:58:39 am
content: I put an ammeter on the power supply of a PIC I was debugging. Sleep means the current consumption goes to 0 as far as a milliammeter is concerned. Wasn't my code or my design so this was the quickest way to find out if the thing was indeed sleeping.

author: AndyC_772
author_rank: Super Contributor
timestamp: June 26, 2017, 07:18:15 am
content: Code:void sleep (void){p_gpio_sleeping = 1;asm ("sleep");p_gpio_sleeping = 0;}

author: cgroen
author_rank: Unknown
timestamp: June 26, 2017, 07:36:26 am
content: Quote from: NiHaoMike on June 26, 2017, 04:34:05 amIf you are afraid that you will forget to set/reset a GPIO pin in this particular situation, then what about the other million situations where you need to set a GPIO pin
Easy pic & avr programming. - Page 1
Forum section: electronics / general

author: stan74
author_rank: Newbie
timestamp: June 25, 2017, 02:21:38 pm
content: Hi guys. I've been using Great Cow Basic for 6 months to program pics and arduino mega328p uno. It's like picaxe basic but a 100 times faster and more features. Expanding hardware library and produces assembler you can see alongside the basic code. It's open source and brill.I used pic assembler 20 years ago but it was not my idea of fun. I tried picaxe and made a robot in a week.It wasn't until I tried to use an oled glcd and had to write the driver code and line/plot functions only to find it took a second to draw a line I realised picaxe was interpreted and slow, although it's called a Basic compiler.I recommend trying Great Cow Basic if like me you find C difficult and Basic easy. It's code is less bloated than Arduino C. Here's a vid I did showing GLCD.
Timing of bits in DALI byte stream? - Page 1
Forum section: electronics / general

author: ocset
author_rank: Super Contributor
timestamp: June 24, 2017, 08:11:45 am
content: Hello,Thankyou very much indeed for all previous answers.We fully deserve our lot, but 2 software engineers have leached us of funds trying unsucessfully to write DALI software. Also, the EU funding we had has been pulled because UK is now leaving the EU. We are grief stricken and going out of business.Our software engineer has failed to get our DALI comms system working for our lamps. (The DALI libraries etc are just too complex). Therefore we are now asking him to just do software “bit-bashing” of the DALI signal, which is just 2 bytes, as attached.However, he is asking if there is a variable delay between the two bytes? (the bytes are Manchester encoded). Also, as you can see, there is a transition every 400us or 800us. Will these timings always exist with DALI? (or will they vary widely).By the way, the softy has actUally got the bit bash code working on our hardware, but he asks us whether the DALI timings will always be the same?It just shows, these softys assured us that it was our hardware that was at fault, and all along, it was their software.....this is prooved by the fact that the bit bashed DALI works fine on the PIC18F26K20 on our PCB.

author: agehall
author_rank: Frequent Contributor
timestamp: June 24, 2017, 11:51:19 am
content: I have not read the full specs on DALI, but 10 minutes of googling (as I had never heard of it before) suggest that it is using manchester encoding and that data is transmitted at 1200bit/s with 1 start bit and 2 stop bits.Given this information, I would not really worry about the timing between bytes - I would look for start bits on the wire and decode the following data accordingly. The only reason I would consider the time between bytes, would be to implement some sort of timeout/reset mechanism.

author: TJ232
author_rank: Frequent Contributor
timestamp: June 25, 2017, 10:03:37 am
content: A very sad story with that 2 "software engineers" and lot to learn about project evaluation, risk assessments, product development, etc.What validator was used by your engineers for testing their DALI protocol implementations? Did they at least deliver a basic driver or something?We have done in the last year extensive work for one of our clients designing DALI master and slaves solutions, both hardware and software, for a integrated Smart Building Management System.If interested in a talk about, just drop me a PM with more details, I will be more than happy to take a deeper look and might find a quick solution for you.Happy breadboarding,TJ.
DSP Book - Real time digital signal processing 2nd edition CD cant find - Page 1
Forum section: electronics / general

author: mateolasic14
author_rank: Newbie
timestamp: June 24, 2017, 09:32:10 am
content: Hi,does anybody have this book Real time digital signal processing 2nd edition and CD that comes with it. I need examples from CD that I cannot find anywhere. If someone has it, please upload or send to mail: mateolasic14@gmail.com . Please help me, Im in hurry and this would help me a lot.
AVR32UC3B Clock Setup - Page 1
Forum section: electronics / general

author: Jacky_88
author_rank: Contributor
timestamp: June 11, 2017, 03:07:27 pm
content: Hello,i'm starting to use 32bit AVRs and I have a problems setting up the main clock.Code:int main(void){AVR32_PM.MCCTRL.osc0en = 1;AVR32_PM.OSCCTRL0.mode = 7;AVR32_PM.OSCCTRL0.startup = 0;while(!AVR32_PM.POSCSR.osc0rdy){;}AVR32_PM.PLL.pllcount = 16;AVR32_PM.PLL.pllmul = 9;AVR32_PM.PLL.plldiv = 1;AVR32_PM.PLL.pllopt = 3;AVR32_PM.PLL.pllosc = 0;AVR32_PM.PLL.pllen = 1;while(!AVR32_PM.POSCSR.lock0){;}AVR32_PM.MCCTRL.mcsel = 2;AVR32_GPIO.port.gpers = (1 << 31);AVR32_GPIO.port.oders = (1 << 31);AVR32_GPIO.port.ovrs = (1 << 31);while (1){AVR32_GPIO.port.ovrt = (1 << 31);}}As far as chapter 9 says, these seetimgs result in a fVCO of 120 MHz (12MHz crystal) and a PLL frequency of 60 MHz. But the settings still don't work. The PLL lock flag never changes resulting in an endless loop

author: ataradov
author_rank: Super Contributor
timestamp: June 11, 2017, 09:14:18 pm
content: Quote from: Jacky_88 on June 11, 2017, 03:07:27 pmWhy? This is one bad move. Just use ARM, you will get better variety of parts and actual support.

author: Jacky_88
author_rank: Contributor
timestamp: June 11, 2017, 09:46:49 pm
content: That is due to the availability of ARM from Atmel in germany. German stores don't offer them (as far as I know) and so I decided to start with the UC3B which is available here. The STM32-F1-series is also available here, which looks interesiting to me too. It would come at lower price for controllers and programmer (Dragon / ICE vs. ST Link V2), but has a huge downside with it's not existing IDE. I've already lying a NUCLEO on my desk. Actually I'm very happy with Atmel and it's visual studio clone and depending on my experience with the AVR32 I would consider buying the ARMs from digikey.com in the future. As a hobbyist I have to consider the shipping fees, when ordering chips from digikey, farnell or mouser or have to purchase beyond some limit to get free shipping. But you're right, these SAMD look very nice

author: Jacky_88
author_rank: Contributor
timestamp: June 23, 2017, 07:49:14 pm
content: The code works. Since I'm, using a simple QFP adapter I had to wire it all manually and I conected the PLL supply to the wrong voltage line.
WCH chip aggregation: are you interested? - Page 1
Forum section: electronics / general

author: technix
author_rank: Super Contributor
timestamp: June 23, 2017, 06:14:32 pm
content: Just like my aggregation of 2DW23x reference diodes from the factory, I think I can provide an order aggregation for WCH chips. Are you interested?Here are the chips that I think you may be interested:Part numberPackageDescriptionCH340CSO-16 150milUSB to UART adapter (drip-in replacement for CH340G, no XTAL)CH340BSO-16 150milUSB to UART adapter (CH340C + internal EEPROM for arbitrary USB VID, PID, description strings and serial number, no XTAL)CH340EMSOP-10USB to UART adapter (CH340C in a 10-pin package, no XTAL)CH395LLQFP-128 14mmSPI/UART/parallel bus to Ethernet interface (like Wiznet W5500)CH395QLQFP-64 10mmSPI/UART to Ethernet interface (like Wiznet W5500, CH395L without parallel slave port)CH374USSOP-24SPI/parallel bus to USB OTG controller with built-in USB Hub, USB Mass Storage Class driver and FAT filesystem driver (USB Hub and built-in drivers are for host mode only.)CH563LLQFP-128 14mmARMv5TE @130MHz microcontroller, 224kB program Flash, 28kB data Flash, 64kB SRAMCH563QLQFP-64 10mmARMv5TE @130MHz microcontroller, 224kB program Flash, 28kB data Flash, 64kB SRAM (CH563L without parallel slave port)CH367LLQFP-64 7mmPCI-Express x1 to SPI/8-bit parallel bus master interface
PSoC gurus: try design this. - Page 1
Forum section: electronics / general

author: technix
author_rank: Super Contributor
timestamp: June 22, 2017, 07:35:01 am
content: The general idea of a mixed-mode power supply have been on my mind for quite a while now. I have a semi-working design but before committing the design to manufacture I would like to ask the PSoC gurus here to match my design using a PSoC.Specifications:* Input: 20V DC, 3.2A maximum* Output: 0-15V, 5A, 50W maximum (whichever comes first)* Topology: Bypassable MOS Low drop-out linear regulator with bypassable two-phase CMOS synchronous rectifying tracking pre-regulator.* Control surfaces: touchscreen, TCP/IP network* Protection: Constant current & constant voltage modes automatic switchover, power element thermal shutdownComponents allowed:* PSoC: One PSoC of your choice, only DIP, SOIC and QFP packages allowed.* Power MOSFETs: Either Two IRF7204 & two IRF7470 or four IRF7470 for the switch-mode section, one IRF4905 or one IRL540N for linear section.* Passive & others: Three power inductors of any value or package, three high value electrolytic capacitors. Any amount of 0603 surface mount resistors, capacitors or inductors of your choice. Any amount of SOT-23 transistors or diodes of your choice.* Since this is the strength of PSoC, no integrated circuits other than the PSoC, up to two IR2101 and up to one DP83848 is allowed. (The touchscreen module does not count here)

author: BravoV
author_rank: Super Contributor
timestamp: June 22, 2017, 10:00:29 am
content: Quote from: technix on June 22, 2017, 07:35:01 amDon't be shy, show us that semi-working design here ...
LWMesh: Meaning of control field in TX callback function - Page 1
Forum section: electronics / general

author: pkr1
author_rank: Newbie
timestamp: June 21, 2017, 09:05:27 pm
content: Hi,I have a question of understanding regarding the TX callback function from the WSNDemo application.What is the meaning of the control field marked in red / which values are possible values for this ?static void appDataConf(NWK_DataReq_t *req){.........if (APP_COMMAND_PENDING ==req->control){SYS_TimerStart(&appCommandWaitTimer);appState = APP_STATE_WAIT_COMMAND_TIMER;}else{appState = APP_STATE_SENDING_DONE;}}Thank'sPeter

author: ataradov
author_rank: Super Contributor
timestamp: June 21, 2017, 09:49:56 pm
content: It is just an application specific field that is sent along with the ACK. This is just a way for the receiver to communicate some information to the sender in the acknowledgment frame itself, without sending another frame.In this case this field is used to tell the device to not go to sleep right away, and wait for the additional commands from the gateway.By default this field is just 1 byte, but you can extend it to be as big as you want.The stack itself never looks at this field. It is passed directly from the application layer on one side to the application on the other side.

author: pkr1
author_rank: Newbie
timestamp: June 21, 2017, 09:55:00 pm
content: Ok, thank you Alex. I understand.
microchip LIN bus and their forums - Page 1
Forum section: electronics / general

author: depot
author_rank: Contributor
timestamp: June 20, 2017, 04:49:06 pm
content: Hello excellent folks!I've asked to register for Microchip forums last Thursday and still no approval. I don't see anything on the internet about unusual slowness about joining their forums, maybe it's just a busy time deal.Anyway I was checking out their LIN demo to consider for a non-automotive project that could use some communication protocol.http://www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=DM164130-3More details: the project would have 3 connector wires and peripherals scattered around a human body. Each would get power, ground, and data for various things. Feel free to suggest something other than LIN, I'm intersted. Wireless is a no-go, and only one central battery around 6V.The main thing I wanted to ask Microchip was about their LIN code. When I set it up for a PIC18F24K20, it consistently fails to see the BREAK initially. It will UART receive but (according to the debugger) the FERR bit won't set, it doesn't see the extra long UART character as a frame error? I thought this might be a baud rate issue but it turns out the LIN analyzer sees 0x55 normally when I continuously transmit that and ignore most of the LIN protocol. The PIC datasheet did say it supports LIN stuff. I wonder if it could be something up with interrupts or UART receive or what. I'll go back and look at it again probably today, maybe test out more subsets of code. I still get a warm fuzzy when putting together a UART loopback test.Anyway thank you for listening to my woes and best wishes to you.Edit: Nevermind! I eventually got into their forums and also figured out what was going on anyway. For some reason my work address wasn't being accepted into Microchip forums. And their MCC code would clear the FERR bit in an interrupt routine with a read before the LIN protocol would use it.
How accurate are AVR watchdog timers? - Page 1
Forum section: electronics / general

author: HwAoRrDk
author_rank: Super Contributor
timestamp: June 24, 2017, 06:03:00 pm
content: I was wondering what the accuracy is like of the watchdog timer on 8-bit AVRs. For example, would it be suitable for timing applications that require some reasonable level of accuracy, but not anything super-precise?To give an example of how I'm considering applying it:I have external square wave signal that I want to measure the frequency of. I'll feed that to a pin that will externally clock a timer. Then with another timer that fires at 1 second intervals, in its interrupt handler I check (and reset) the first timer's counter value to get the frequency reading.Because of otherwise a very low I/O count requirement I'm looking to use the ATtiny series, and nearly all of them have a paucity of timers (only 1 or 2), and that with the above arrangement I would need three total (I need to do PWM output too), I was wondering whether I could instead use the watchdog timer for my 1 second interval.However, I'm not sure I'd get a very accurate frequency measurement with the watchdog timer when the datasheets say of the WD oscillator things like "provides a clock source with an approximate frequency of XXX kHz" and "the frequency depends on supply voltage, temperature and batch variations". In one datasheet, buried in the electrical characteristics section, there is even a specified accuracy of only ±30% over the part's given temperature and VCC range!Is the accuracy better given a stable operating voltage and temperature? Or should I forget the idea and find an ATtiny that has 3 timers? (ATtiny841 looks like it might fit my needs.)

author: madires
author_rank: Super Contributor
timestamp: June 24, 2017, 06:23:23 pm
content: I'd go for an ATtiny with three timers. The watchdog timer is only useful for non-time-critcal stuff.
ADC on PIC12F1571 no response - Page 1
Forum section: electronics / general

author: step_s
author_rank: Regular Contributor
timestamp: June 19, 2017, 12:11:57 am
content: Hi guys.Wanted to program a simple ADC, and I remember using the code before, but now it doesn't seem to work.I have hooked up a pot to RA4, and wanted it to just pull RA2 high or low, depending on the threshold.The ADC doesn't seem to be running, so I'm a little confused as to what part of the code that's not working. Everything else on the PIC is working like it should.Code:unsigned int ADC;void main(void) {TRISA = 0b00010000; //RA4 inputANSELA = 0b00010000; //RA4 analogODCONA = 0b00000000; //No open-drainOSCCON = 0b11110000; //32MHz internalADCON0 = 0b00001101; //Set pin R4 AN3, Enable ADCADCON1 = 0b10000000; //Right justified, Fosc/2, VDD as ref+while(1){GO_nDONE = 1; //Initiate ADCwhile(GO_nDONE); //Wait for ADCADC = (ADRESH << 8 | ADRESL); //Gather result in 1 integerif (ADC >= 100) { //If voltage is high, set RA2 highRA2 = 1;}if (ADC <= 100) { //If voltage is low, set RA2 lowRA2 = 0;}}return;}Hope you can help.

author: StillTrying
author_rank: Super Contributor
timestamp: June 19, 2017, 01:25:52 am
content: ADCON1 = 0b10000000; //Right justified, Fosc/2, VDD as ref+I think you have to use Fosc/32 with a 32MHz osc.
Generating security metal detector sounds - how? - Page 1
Forum section: electronics / general

author: igendel
author_rank: Frequent Contributor
timestamp: June 27, 2017, 01:41:24 am
content: Hi,I'm in the process of designing the electronics for a toy of sorts, and the client suddenly decides he wants it to also make the familiar scanning sounds of metal detectors, like the audio in this:That video has two kinds of sound, 0:00-0:08 and 0:09-0:18. Either would be fine, and it's not supposed to respond to actual metal or any other input. The catch is that I need to produce the sound using an 8-bit MCU and a piezo element (or a very small speaker), because I already have those in the system and there's very little room for other components.Looking at the waveforms with non-expert eye, it seems there's a lot of amplitude changes:Short, rapidly-decaying clicks with variable distancesSome kind of high-pitched slide-whistle AM signal?So, how can I go about generating these or similar sounds? Can it be done with the aid of a reasonably small analog circuit of some kind? All the metal-detector-related circuits I could find on Google are for actually detecting metal, not for sound...Thanks!

author: igendel
author_rank: Frequent Contributor
timestamp: June 27, 2017, 06:11:30 pm
content: For future generations reading this...I discovered that outputting a square wave to a speaker, from say 1KHz to 8KHz and back, in 100Hz steps, ~4ms for each frequency, gives a nice "sliding" sound effect similar to that of the metal detector. Still requires work but it's a start
LWMesh NWK_DataReq Infinite Loop Condition - Page 1
Forum section: electronics / general

author: friendly_giant
author_rank: Newbie
timestamp: June 15, 2017, 08:49:18 pm
content: I have encountered my device enter into an infinite loop when NWK_DataReq is called for the same req twice without clearing it from the queue. I have added the following catch to prevent this:Code:void NWK_DataReq(NWK_DataReq_t *req){req->state = NWK_DATA_REQ_STATE_INITIAL;req->status = NWK_SUCCESS_STATUS;req->frame = NULL;nwkIb.lock++;if (NULL == nwkDataReqQueue) {req->next = NULL;nwkDataReqQueue = req;}else if (nwkDataReqQueue==req){ //catch duplicate reqprintf("double message \r\n");}else{req->next = nwkDataReqQueue;nwkDataReqQueue = req;}}What I don't know yet is why this is happening, it seems that there shouldn't be a condition where NWK_DataReq is called twice on the same req frame. Also, would like input on whether it is dangerous to put this catch in there, whether I might lose data.

author: ataradov
author_rank: Super Contributor
timestamp: June 15, 2017, 09:16:26 pm
content: This is documented and done on purpose. You should never call this request twice on the same structure before previous confirmation is called.The infinite loop is a clear and cheap indication that something is wrong with your program. Your high level logic should prevent calls like this.

author: ataradov
author_rank: Super Contributor
timestamp: June 15, 2017, 10:05:17 pm
content: Also, you are only verifying that your request is not the same as the last request. This check will not catch things like: ReqA, ReqB, ReqA again.