hybridfree/eevblog-posts huggingface dataset:
Stm32 converting float/int into string and pushing it to screen(need suggestion) - Page 1
Forum section: electronics / general

author: basantab
author_rank: Contributor
timestamp: December 07, 2018, 03:34:14 pm
content: HelloI am using 4D system screen(lets say some screen) with stm32. And it has inbuilt library function of putstr(). I am taking adc data(voltage) to stm32 and converting it and pushing it into screen. The problem is it does have putCH function but doesnot work if i push number using that but how ever using putstr function it can push string in screen which leaves me to use this function by converting integer (actually float) into string and then use this function to push.I would be glad if i was able to convert decimal number(float) into string and push it into screen.but however this code below can at least convert integer into str (without decimal sadly).Code:char buffer;int x = 3333; //voltage for examplesnprintf(buffer, 10, "%d", x);putstr(buffer); //function that prints str frm Lcd libraryHAL_Delay(2000);the above works for integer.I tried floating point numbers this way but it doesnot print it. probably my floating point conversion is not correct.can anyone suggest conversion regarding floating point conversion ?I would really thank your name if i am able to solve that..

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 07, 2018, 04:43:49 pm
content: The *printf() functions do not support floating point by default on those targets, and that's probably the problem you're running into.You can refer to the following thread for solutions:https://www.eevblog.com/forum/microcontrollers/stm32-smbus-and-sprintf-with-floats

author: richardman
author_rank: Frequent Contributor
timestamp: December 07, 2018, 09:59:44 pm
content: It depends on whether you are using nanolib, or plain newlib, and that depends on how you set up your makefile or IDE etc. basically linker flags.newlib supports %f/%g etc. by default.nanolib does not by default and you need to explicitly enable float capable printf.A couple checkbox in our IDE, translated to a handful of different scenarios.

author: nctnico
author_rank: Super Contributor
timestamp: December 08, 2018, 12:15:37 am
content: I'd strongly recommend to find a minimal vuprintf (the mother function of all printfs) and if necessary add floating point printing to it. I went down this road for a recent project and this route was the most sane one because even newlib nano pulls a lot of junk into the project. There is nothing nano about it.
PIC16F1703 - can't overcome stall current of motor - Page 1
Forum section: electronics / general

author: JoeP
author_rank: Contributor
timestamp: December 08, 2018, 04:09:48 pm
content: I'm trying to drive a small motor (around 20mA when spinning) directly from the output of a microcontroller. The datasheet says it can cope with 50mA, however when the motor is turned on, the pin output voltage is pulled down from 5V to under 1V, stopping the motor from getting started. I tried giving it a little nudge, and once it's spinning, the pic handles it fine, but it just struggles getting it going. Without having to introduce an H-bridge, how can I get the motor to start?

author: lucazader
author_rank: Regular Contributor
timestamp: December 08, 2018, 10:50:03 pm
content: You will probably find that while the no-load current of the motor spinning is 20mA, the stall current of the motor is likely to be much higher.It sounds like the stall current, or at least the peak current required at startup to get the motor spinning is probably more in the order of 250mA or so.Usually running loads like motors isn't a great idea directly off a micro's pins. LEDs etc are usually fine.Might be an idea to try and run this using external mosfets, or an external motor driver chip, and use an o-scope across a current shunt resistor to see what kind of current peaks are required at startup.

author: Nauris
author_rank: Regular Contributor
timestamp: December 09, 2018, 02:45:47 pm
content: Quote from: JoeP on December 08, 2018, 04:09:48 pmFirst try if it helps to put the pin in open-drain mode. (ie. Connect other end of motor to +5V and use the output pin to ground the other end). Usually nmos devices are stronger.If that does not help, use two outputs pins in parallel (preferably in open drain mode)

author: mikerj
author_rank: Super Contributor
timestamp: December 10, 2018, 10:51:48 pm
content: Really not a good idea to drive inductive loads like motors directly from a port pin.

author: picandmix
author_rank: Frequent Contributor
timestamp: December 12, 2018, 09:21:12 am
content: Hi,Just plain silly to try and drive a motor form a Pics port, all you are likely to do is blow up the pic.As with any "power" device, you never run things at their full output. eg why don't you drive a car at maximum revs all the time ?All thats needed is a simple transistor and resistor like this circuit, many similar circuits on the web; a flyback diode is needed as well, in not already fitted.If you want to do more advance motor control then get one of the L298 modules for under £3.
Does STM32F0 series have input diodes for GPIO? - Page 1
Forum section: electronics / general

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: December 04, 2018, 10:22:08 am
content: Hi,I have looked inside their datasheet, but there is no info regarding these protection diodes like the AVR's and other devices, Am I missing something?

author: tszaboo
author_rank: Super Contributor
timestamp: December 04, 2018, 12:09:08 pm
content: It is in the family reference manual, not in the datasheet.https://www.element14.com/community/servlet/JiveServlet/downloadBody/49865-102-1-259885/STMicroelectronics.Reference_Manual.pdfpage 119 of this one.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: December 04, 2018, 02:58:13 pm
content: Thanks, I was testing STM32F030K6T6But it seems there are none in this family

author: newbrain
author_rank: Super Contributor
timestamp: December 04, 2018, 03:15:29 pm
content: Quote from: ali_asadzadeh on December 04, 2018, 02:58:13 pmI suspect they have removed them from the simplified schematics.None appears in the last RM version for 042 and for 072 too.From the current injection and input voltage ratings, I'm confident they are still there (with a different reference for the 5V tolerant pins, as expected!).

author: ataradov
author_rank: Super Contributor
timestamp: December 04, 2018, 04:37:01 pm
content: Most (all?) digital devices will have current limiting diodes. I don't think STM MCUs are nay different here.

author: ali_asadzadeh
author_rank: Super Contributor
timestamp: December 05, 2018, 05:42:22 am
content: Then why they have removed it in the docs!
Resetting HC08 stack pointer when exiting sub - Page 1
Forum section: electronics / general

author: Circlotron
author_rank: Super Contributor
timestamp: December 04, 2018, 06:19:17 am
content: I just read that doing a RSP on a HC08 only resets the lower 8 bits of the stack pointer. I have sometimes used the expedient of RSP after exiting a subroutine rather than completing the sub then RTS. So... the red-faced question is, is it okay to do this provided the stack is less than 255 deep? I don't know how deep my stacks would be but probably not more than 10 or 20. I only write in assembly, and not super complicated stuff.
Free Microchip AVR-IoT boards - Page 1
Forum section: electronics / general

author: electromakerio
author_rank: Newbie
timestamp: December 03, 2018, 11:11:54 am
content: Electromaker.io has got 100 Microchip AVR-IoT boards to giveaway.All you have to do is submit a 100-150 word project idea to us. If we like their project idea then we will send you a board free of charge. The recipient of the board can then use it as the platform for their project which they can then submit to our contest which offers some great prizes.All the information can be found in the link below:https://www.electromaker.io/contest/microchip-iotIf you have any questions let me know
PIC18F46K42 xpress EVAL Board - ADC program - Page 1
Forum section: electronics / general

author: arul
author_rank: Regular Contributor
timestamp: December 02, 2018, 05:10:08 pm
content: Hi,I have a PIC18F46K42 xpress evaluation board. Now I am developing one of the ADC program using MPLAB Xpress PIC18F46K42 evaluation board on MPLAB CLOUD IDE. I make one of the simple circuit for that program using variable power supply, resistor. I am varying the power source, but that ADC result register value does not change, only shown 0x00 (i got that value 0x00, in debug mode). I have attached my code and circuit.Please let me know, what is going wrong.....void main(){int RH, RL;ADCON0bits.FM = 1;ADCON0bits.CS = 1;ADPCH = 0b00011100; //RD4 is analog inputTRISDbits.TRISD4 = 1;ANSELDbits.ADSELD4 = 1;ADCON0bits.ON = 1;while(1){ADCON0bits.GO = 1;while(ADCON0bits.GO);RH = ADRESH;RL = ADRESL;}}

author: Buriedcode
author_rank: Super Contributor
timestamp: December 02, 2018, 09:04:52 pm
content: In order to check if your code is enough people would have to find the datasheet, go to the ADC section, as well as the GPIO section and check that all the required config registers are correct. Whilst I'm sure other will do that its a fair bit of work. So perhaps you could use the mplab xpress code configurator, then view the generated code for the ADC? (you'll probably have to look at the IO code too).That should show you all the registers relating to the ADC, and you can then use their values along with the datasheet to see what the "configurator" has done, and why it has done it.Also, you haven't provided your entire code. How are you reading RH and RL? From debugger? GPIO port? serial?
SAM4E flashing first program - Page 1
Forum section: electronics / general

author: hsn93
author_rank: Regular Contributor
timestamp: December 05, 2018, 02:45:38 pm
content: hello,i've designed board for SAM4E16E.a very bad move i did is that i did not connect any pin in the board to led (flashing leds is really helpful for debug) or didnt put jtag connector.anyway, i only have Erase option on the board.and its connected to USB.so i've connected it to the PC and i can see (COM4 as "Bossa Program Port")now im using Bossac which supports SAM4E. to upload simple program:after flashing the firmware, and reset, i still see the "COM4" which means the bootloader is still there? shouldnt it exit to my software until i erase the chip?what i can think of, is that SAM-BA checks for the program and cant find it in the memory, but i didnt play with the flash.ld fileflash.ld:https://pastebin.com/raw/YRZuefCathe code has infinite loop also:Code:#include <asf.h>int main (void){/* Insert system clock initialization code here (sysclk_init()). */board_init();/* Insert application code here, after the board has been initialized. */while(1){}}

author: hsn93
author_rank: Regular Contributor
timestamp: December 06, 2018, 05:41:55 am
content: the problem solvedthere isboot from flashthat you can set in SAM-BA i guess (somthing like fuses)..boot to ROM bootloader from ASF code: (add flash_efc service)Code:flash_clear_gpnvm(1);NVIC_SystemReset();
Concurrency Challenges of ISRs - Page 1
Forum section: electronics / general

author: obiwanjacobi
author_rank: Super Contributor
timestamp: November 30, 2018, 07:18:09 am
content: I really enjoyed this talk. Good stuff!

author: obiwanjacobi
author_rank: Super Contributor
timestamp: December 01, 2018, 04:34:02 pm
content: BTW: don't be put off by 'cpp' in the title.There is no cpp code in the talk.The content applies to any one who programs MCU's and uses interrupts.
Designing circuit for 16 x32 LED matrix display - Page 1
Forum section: electronics / general

author: sangar
author_rank: Regular Contributor
timestamp: December 01, 2018, 01:50:55 pm
content: Hello all,I am on designing a driver circuit for 16x32 LED matrix display...I have just find outSTP16DP05from STMicro electronics...It has max sink current of 100mA per channel and also I had a reference design which is for 16 x 32 led set up for this chip...In the reference design, two of this chip has used and alternate rows are connected to each channel of them...As a result, each channel had 8 LEDs to drive...But in our case, I want to change it 4 LEDs per channel since I want to drive the LED at 20 mA though it increases the number of the chips...Our idea is that, instead of dividing the 16 rows by 2, we want it by 4 so that each drive 4 LEDs...But, I am wondering that number of row selection need to be extended...Could anyone share their knowledge...The circuit picture I have cut from its pdf is not clear.So, I attached pdf...The circuit is on page number 23
Text scroll on led matrix using AM335x - Page 1
Forum section: electronics / general

author: samy03
author_rank: Contributor
timestamp: November 30, 2018, 03:10:45 pm
content: Hi All,I am using beaglebone to scroll text on a led matrix which is made of 5 32x32 panels connected in daisy chained.One panels look like this:https://www.adafruit.com/product/607I am able to scroll text using github repo ledscape:https://github.com/osresearch/LEDscapeThe only thing is, text scroll is not smooth and sometimes flickers as well. Plus ledscape sometimes just causes hard crashes.What would be a better way to scroll text on this type of led panel?Any suggestions would be greatly appreciated.Thank you
Choppy output on TDC chip (max35101) - Page 1
Forum section: electronics / general

author: maoterk
author_rank: Newbie
timestamp: December 10, 2018, 07:20:08 pm
content: I am trying to build an ultrasonic flow meter with the TDC max35101 and have come upon an issue. When i connect the ultrasonic transducers to the chip, the output pulses are a bit choppy (pic1) generating wrong measurements on the receiver side. It should be a smooth sinusoidal signal so that the comparator has smooth output. When i disconnect the transducers i get the normal pulses (pic2). Why is this happening and what could i do to avoid it. The transducer's capacitance is 1200pF. The circuit is uploaded also.thanks

author: shakalnokturn
author_rank: Super Contributor
timestamp: December 12, 2018, 01:40:44 am
content: I have no experience on the MAX35101 or on the subject in general.Your waveform shows crossover distortion. Are you overloading the LAUNCH outputs? The datasheet doesn't say much on the subject, the only figure I noticed was 50mA...Try using a higher resistance between LAUNCH outputs and transducer. Or at least diff. probe the voltage across them to get some idea of the current you are drawing.If increasing the resistance enough isn't practical because of transmission losses maybe consider an external transducer drive stage.Lowering pulse frequency could also be a compromise.

author: maoterk
author_rank: Newbie
timestamp: December 12, 2018, 01:05:12 pm
content: Upon further investigation the issue seems to be a different one (maybe). Whenever the receiver is enabled (after the programmed delay) (Screenshot1) there is a lot of noise which makes correct comparator output impossible. As you can see in Screenshot2 the actual received signal is very clean if the receiver is enabled after the signal which is pointless. The capacitors at the receiver end are 1nF. Any ideas?I'll try using a higher resistance between LAUNCH outputs and transducer.thanks for the help
Transmitting and receiving error states for sensors with human readable packet - Page 1
Forum section: electronics / general

author: daqq
author_rank: Super Contributor
timestamp: November 29, 2018, 11:51:35 am
content: Hi guys,I'm creating two devices that communicate together with a simple packet, formated like this:Code:!H,12.01,42.24,Checksum\r\nWhere the 12.01 and 42.24 values are used to transmit floating point numbers. Generally, the two devices will be used together, but there might be a scenario where they are used separately.The transmitting device pretty much reads out several sensors. How would you go about transmitting a bad state (sensor channel disconnected, shorted...) to the upper system? At the moment I'm setting the float values to nan, which is then conveniently printf'd into "nan" and on the other side it's scanf'd back into nan.Transmitting some special string (say, "ERR") when the sensor is broken complicates things on both sides, but it would look much nicer. The parsing at the moment can be achieved by one sscanf line.If you were buying a device, would you be OK with "nan" used when the specific channel has an error, or would you prefer "ERR"?Thanks,David

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: November 29, 2018, 12:09:25 pm
content: ERR is clear, nan not as much.

author: Gribo
author_rank: Frequent Contributor
timestamp: November 29, 2018, 12:55:12 pm
content: Don't overload messages. Since you already use a human readable format, there is nothing gained by sending a NaN vs a proper error message.
68hc912b32 preogrammer schematic need pls. - Page 1
Forum section: electronics / general

author: Chriss
author_rank: Frequent Contributor
timestamp: December 16, 2018, 05:02:31 pm
content: Hi!I have to r/w this type of uC 68hc912b32.Can somebody help me with a DIY programmer schematic?I don't use often Motorola uC's and I won't buy an expensive programmer tool for this uC'sif possible to make something at home...Thank you very much.My best regards.

author: james_s
author_rank: Super Contributor
timestamp: December 16, 2018, 05:39:11 pm
content: While not DIY, this is a lot cheaper than the official solution.https://www.aliexpress.com/item/2016-the-newest-ETL-programmer-912-9S12-Programmer-high-quality-and-works-perfect-free-shipping/32754162016.html
AVR Programming Issues - Page 1
Forum section: electronics / general

author: joeyjoejoe
author_rank: Frequent Contributor
timestamp: November 28, 2018, 11:50:58 pm
content: I have an AVR (Attiny85) in a very basic circuit, using a a W25Q32JV (https://www.winbond.com/resource-files/w25q32jv%20spi%20revc%2008302016.pdf) memory chip.I'm having problems programming it. Doing a bit of thinking, I realized the flash memory is probably interfering with the SPI programming. So, I put a 4.7k resistor to pullup /CS, which should hopefully keep that chip quiet. However, still no luck.The output looks like it is properly talking to SOMETHING on the SPI bus.Code:avrdude: Using SCK period of 10 usecavrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.00savrdude: Device signature = 0xffffff (probably .avr8x_mega) (retrying)Reading | ################################################## | 100% 0.00sError during upload using programmerThe uploader process failedI can probably just unsolder the flash serial chip and program it, but that wouldn't help much when it comes time to flashing new versions of the software.Any thoughts on something obvious I'm missing?

author: rstofer
author_rank: Super Contributor
timestamp: November 29, 2018, 12:49:44 am
content: Section 4.1.1 here:http://ww1.microchip.com/downloads/en/AppNotes/atmel-2521-avr-hardware-design-considerations_applicationnote_avr042.pdf

author: joeyjoejoe
author_rank: Frequent Contributor
timestamp: November 29, 2018, 01:36:51 am
content: Thanks!
ESP32 I2C writes work but not reads? - Page 1
Forum section: electronics / general

author: NiHaoMike
author_rank: Super Contributor
timestamp: November 28, 2018, 06:04:24 am
content: I'm working on a project that involves an ESP32 communicating with various I2C slave devices, such as a MCP23017.This works as expected:Code:void MCP_writeA(uint8_t dat) {Wire.beginTransmission(0x20);Wire.write(0x12);Wire.write(dat);Wire.endTransmission();}This always returns 0 regardless of what the slave actually sent:Code:uint8_t MCP_readA() {Wire.beginTransmission(0x20);Wire.write(0x12);Wire.endTransmission(false);Wire.requestFrom(0x20, 1);return Wire.read();}This, for reading the cell voltages from the BMS, also doesn't work:Code:void BMS_Vcell(uint16_t ret[]) {Wire.beginTransmission(0x19);Wire.write(0x00);Wire.endTransmission(false);Wire.requestFrom(0x19, 8);ret = (Wire.read() << 8) | Wire.read();ret = (Wire.read() << 8) | Wire.read();ret = (Wire.read() << 8) | Wire.read();ret = (Wire.read() << 8) | Wire.read();}In all cases, I have verified that the traffic on the bus is as expected with a logic analyzer. (As in the slaves are in fact returning data.) I'm using the stable (1.0.0) arduino-esp32 core on the Arduino 1.8.7 IDE. I'm simply calling Wire.begin() to initialize the I2C.

author: hamster_nz
author_rank: Super Contributor
timestamp: November 29, 2018, 11:32:41 pm
content: I have sometimes had these sorts of issues with a multi-function pin that isn't configured with the desired function. See if you use a different I/O pin and get similar results.... humm... just had a look on the web while waiting for something to happen, and it looks like it should work.Have you looked at what Wire.available() says?

author: tsman
author_rank: Frequent Contributor
timestamp: November 30, 2018, 03:08:57 am
content: There are several I2C bugs in arduino-esp32 core 1.0.0. They're only fixed in the development branch so try 1.0.1RC1.

author: NiHaoMike
author_rank: Super Contributor
timestamp: November 30, 2018, 05:13:47 am
content: Quote from: tsman on November 30, 2018, 03:08:57 amThat was it. Over 2 years since the ESP32 was released to public and something as basic as I2C is still broken on the stable branch? Just imagine how confusing it would be without a logic analyzer to get the ground truth of what's going on...

author: tsman
author_rank: Frequent Contributor
timestamp: November 30, 2018, 01:44:25 pm
content: Quote from: NiHaoMike on November 30, 2018, 05:13:47 amOops. I made a typo on the version since it should be 1.0.1RC1 but you worked that out.ESP32 Arduino core 1.0.0 only came out a few months ago but that isn't any excuse for this mess. This I2C bug was known about months before 1.0.0 was even released and somebody had already made a fixed version of the library.
[SOLVED] STM32L4 SPI RX-only not reading anything... Help? - Page 1
Forum section: electronics / general

author: technix
author_rank: Super Contributor
timestamp: November 24, 2018, 07:46:56 pm
content: Edit: Solved:my GPIO configuration is wrong.I am trying to build something that uses an RX-only SPI master with DMA on a STM32L433. However regardless how I try the SPI is not reading anything. Help?The following code contains the SPI logic. TIM7 here controls the beginnings of the read bursts, and it is disabled here.Code:/** spitemp.c** Created on: Nov 25, 2018* Author: technix*/#include "spitemp.h"volatile uint32_t temp_reading = 0;static volatile uint32_t temp_buffer = 0;static void spitemp_begin_capture(void);static void spitemp_end_capture(void);void spitemp_begin(void){RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN;RCC->AHB1ENR |= RCC_AHB1ENR_DMA1EN;RCC->APB1ENR1 |= RCC_APB1ENR1_TIM7EN;RCC->APB2ENR |= RCC_APB2ENR_SPI1EN;SET_FIELD(GPIOA->AFR, 0x0fff0000, 0x05550000);SET_FIELD(GPIOA->MODER, 0x000003f0, 0x000002a0);SPI1->CR1 =SPI_CR1_CPHA |SPI_CR1_MSTR |(4 << SPI_CR1_BR_Pos) |SPI_CR1_RXONLY;SPI1->CR2 =SPI_CR2_SSOE |(7 << SPI_CR2_DS_Pos) |SPI_CR2_FRXTH;SET_FIELD(DMA1_CSELR->CSELR, DMA_CSELR_C2S_Msk, 1 << DMA_CSELR_C2S_Pos);DMA1_Channel2->CCR =DMA_CCR_TCIE |DMA_CCR_MINC |(0 << DMA_CCR_PSIZE_Pos) |(0 << DMA_CCR_MSIZE_Pos);DMA1_Channel2->CPAR = (uint32_t)&(SPI1->DR);__DSB();NVIC_EnableIRQ(DMA1_Channel2_IRQn);TIM7->CR1 = TIM_CR1_URS;TIM7->DIER = TIM_DIER_UIE;TIM7->CNT = 0;TIM7->PSC = 10000 - 1;TIM7->ARR = 8000 - 1;NVIC_EnableIRQ(TIM7_IRQn);//TIM7->CR1 |= TIM_CR1_CEN;spitemp_begin_capture();}static void spitemp_begin_capture(void){DMA1_Channel2->CMAR = (uint32_t)&temp_buffer;DMA1_Channel2->CNDTR = sizeof(temp_buffer);__DSB();SPI1->CR2 |= SPI_CR2_RXDMAEN;DMA1_Channel2->CCR |= DMA_CCR_EN;SPI1->CR1 |= SPI_CR1_SPE;}static void spitemp_end_capture(void){DMA1_Channel2->CCR &= ~DMA_CCR_EN;SPI1->CR1 &= ~SPI_CR1_SPE;SPI1->CR2 &= ~(SPI_CR2_RXDMAEN | SPI_CR2_TXDMAEN);temp_reading = temp_buffer;__BKPT(0);}void TIM7_IRQHandler(void){TIM7->SR = 0;spitemp_begin_capture();}void DMA1_Channel2_IRQHandler(void){if (DMA1->ISR & DMA_ISR_TCIF2){DMA1->IFCR = DMA_IFCR_CTCIF2;spitemp_end_capture();}}

author: capt bullshot
author_rank: Super Contributor
timestamp: November 24, 2018, 07:57:01 pm
content: Didn't check details, but in general with SPI you have to send dummy words to receive anything. I didn't see writes to the SPI data register.

author: technix
author_rank: Super Contributor
timestamp: November 24, 2018, 08:00:02 pm
content: Quote from: capt bullshot on November 24, 2018, 07:57:01 pmWhen configured as RX-only, as the documentation suggests, it does not need or even accept TX data.I have tried setting up DMA to write dummy bytes but that never worked either.

author: technix
author_rank: Super Contributor
timestamp: November 28, 2018, 04:55:19 am
content: Fixed: my GPIO settings are wrong.
DMA to read GPIO (8bit data bus) with 6 trigger signals - Page 1
Forum section: electronics / general

author: luiHS
author_rank: Frequent Contributor
timestamp: November 24, 2018, 12:00:29 pm
content: Hi.I need to make a program with a Kinetis MK66 to read an 8-bit data bus, based on a control bus of 6 signals that should act as a trigger to capture the 8 bits of the data bus.I have thought about using DMA, but I still have no experience, so I do not know if it is possible to use 6 signals as a trigger to activate the DMA to capture the 8-pin data of the GPIO in port A. Then according to which signal of 6 has trigger, I would save the 8 bits in an array.I have this source code example, but only with one trigger at PTB16:#define OUTPUT_LENGTH 100unsigned long ulOutput;static void fnSampleBus(void){unsigned long ulOutput;INTERRUPT_SETUP interrupt_setup; // interrupt configuration parametersinterrupt_setup.int_type = PORT_INTERRUPT; // identifier to configure port interruptinterrupt_setup.int_port = PORTB; // the port that the interrupt input is oninterrupt_setup.int_port_bits = PORTB_BIT16; // UART input pin on FRDM-K64Finterrupt_setup.int_port_sense = (IRQ_FALLING_EDGE | PULLUP_ON | PORT_DMA_MODE); // DMA on falling edgeinterrupt_setup.int_handler = 0; // no interrupt handler when using DMA// Configure the DMA trigger//fnConfigDMA_buffer(9, DMAMUX0_CHCFG_SOURCE_PORTB, sizeof(ulOutput), (void *)&(((GPIO_REGS *)GPIOC_ADD)->PDIR), (void *)&ulOutput, (DMA_DIRECTION_INPUT | DMA_LONG_WORDS), 0, 0); // use DMA channel 9 without any interruptsfnDMA_BufferReset(9, DMA_BUFFER_START);}

author: bson
author_rank: Unknown
timestamp: November 26, 2018, 11:27:29 am
content: I'm not familiar with the K66, but the K64 family has a DMAMUX that muxes peripheral sources to DMA channels. With it the 6 trigger inputs I believe can be muxed to one DMA channel; set the DMA channel to operate in 16-to-16 bit mode and let it capture the 8 data bits plus the 6 trigger inputs, plus 2 meaningless pad bits. This way you'd get a single 16-bit record of triggers and data lines. If you stuff them into 6 different byte arrays, one for each trigger, you won't know which order the triggers occurred.More sensibly, you'd make the triggers fire a timer, which paces a DMA channel and captures the 6 triggers and 8 data lines at some sampling interval, either until none of the triggers are active, some time period has passed, or some other condition. But it really depends on what you're going to use it for.
stm32f373: stability of DAC/ADC? - Page 1
Forum section: electronics / general

author: exe
author_rank: Unknown
timestamp: November 09, 2018, 08:50:40 pm
content: Dear forum,I'm building a power supply and I wonder how stable are DAC and ADC (the one that is 16 sigma-delta) on stm32f373. Do they drift much with age and temperature?Another question: if I use a separate supply for Vref, how can I ensure it never exceeds Vcc+0.4V (esp. on startup)? I could put a a diode, but it may have a bigger drop.UP on the second thought, a small-signal Schottky may do the job, but still ideas on proper power sequencing are welcome. May be I need a power supervisor or something that will only enable Vref after Vdd is up. Or, may be I can use MCU to enable Vref only after it boots and after some delay...

author: iMo
author_rank: Super Contributor
timestamp: November 10, 2018, 01:06:43 pm
content: The ADCs and DACs do not age/drift much. Vrefs do.In case your external Vref will be lower than Vcc (ie 2.5V) I would not care much about startup conditions.The tempco of the internal Vref is 100ppm/C (read the datasheet).Also mind the ext Vref+/- pins might be available with large packages only.Otherwise the performance of the MCU's internal ADCs and DACs is inferior to the discrete ones..PS: the temperature of the stm32's die depends on its activity. It could vary +/-xxC based on which part of your code runs at the moment..

author: exe
author_rank: Unknown
timestamp: November 23, 2018, 08:01:14 pm
content: Thank you very much.To my surprise, SDADC has temperature drifts specified in the datasheet. I'd say drifts are quite noticeable, especially in single-ended mode.

author: lucazader
author_rank: Regular Contributor
timestamp: November 23, 2018, 11:14:21 pm
content: If the temp drift is specified in the datasheet then you should be able to use the on chip temp sensor to compensate for this.

author: exe
author_rank: Unknown
timestamp: November 24, 2018, 07:27:44 am
content: Quote from: lucazader on November 23, 2018, 11:14:21 pmThe datasheet tells only typical/maximum drift, so I don't think it can be compensated without manual characterization.

author: AndyC_772
author_rank: Super Contributor
timestamp: November 24, 2018, 08:36:43 am
content: Some users have experienced 'saw tooth' drift with the SDADC on STM32F373, it's well worth doing a search to see what turns up.Here's a starting point:https://community.st.com/s/question/0D50X00009cd2WLSAY/stm32f373-sdadc-drift

author: electrodacus
author_rank: Super Contributor
timestamp: November 26, 2018, 08:24:58 am
content: I use the STM32F373 in my projects for a few years and the SDADC is excellent so is the internal reference so I will not bother with an external one. I have no experience with the DAC but I suspect that should be good also it is just lower resolution.My projects are all open source so if you need some inspiration check my latestKickstarter pageas there is where you will find user manual for all projects and all of them have the links for SW and HW files on the last page of the manual.
PIC micro controller oscillator frequency - Page 1
Forum section: electronics / general

author: khatus
author_rank: Regular Contributor
timestamp: November 25, 2018, 12:35:49 pm
content: Hello guysThe internal clock (Q1–Q4) of PIC Micro controller runs at a quarter of the oscillator frequency (FOSC/4).My question is if i divide the frequency with 4 Then the timer period of each clock pulse will increase 4 times.However this picture is confusing. it shows after the internal circuitry divides the clock into four even quadrature clocks. the timer period of each clock (i.e Q1, Q2, Q3, and Q4) less than the main primary oscillator(that is connected to the OSC1 and OSC2 pins).But i think time period of each clock pulse must be 4 times time period of main primary oscillator.1. Can anybody explain the above??2.What is the frequency of oscillator is it FOSC/4 or only FOSC??3. What is machine cycle ??

author: iMo
author_rank: Super Contributor
timestamp: November 25, 2018, 12:58:58 pm
content: When talking the pic12F..18F chips the Q1-Q4 are the "names" for the 4 "internal processor cycles" or "a single machine cycle", not the 4 individual clocks.Therefore with Xtal/RC/Fosc 8MHz, the internal clock is 8MHz, but the processor needs 4 cycles (periods) of this 8MHz clcok to make a single instruction - a machine cycle (or more).For example, with 8MHz Xtal (125ns period) the max speed is 2million instructions per second.The CLKOUT frequency will be 8MHz/4 = 2MHz --> 500ns period where the pic does one single instruction (internally the processor needs min 4x125ns to make a single instruction).The pic24/dspic33 need 2 clocks/instruction (or more) and the pic32 1clock/instruction (or more).

author: khatus
author_rank: Regular Contributor
timestamp: November 25, 2018, 04:56:33 pm
content: What is oscillator cycle??what is the frequency of oscillator cycle??

author: Buriedcode
author_rank: Super Contributor
timestamp: November 25, 2018, 09:52:55 pm
content: Quote from: khatus on November 25, 2018, 04:56:33 pmFOSC. That is the oscillatorfrequencyin Hz, thecycleis the inverse of this, in seconds. If you hadn't guessed FOSC isFrequency of theOSCillator.
SD Card Info - Page 1
Forum section: electronics / general

author: @rt
author_rank: Super Contributor
timestamp: November 23, 2018, 06:38:37 am
content: Hi Guys,When I was using Microchip’s MDDFS library in a project implementing an SD card,I filled in a few gaps such as retrieving the name of the partition, and card capacity, etc. that was never written into the library.I’ve since become interested in the SD card’s CID register, which is never accessed by MDDFS library at all,probably because the info contained it it is not vital to the card’s operation in the way the CSD register is.In a nutshell. it’s easy to simply duplicate the CSD request routine, and change that to issue CMD10 instead of CMD9.Something I’ve found interesting is that some cards send no 0xFE token before their reply, and some cards that do send the 0xFE token, also send an 0xFF byte before the token.So an issue arises where the correct reply has to be aligned to calculate the reply checksum.So there can be no hard rule to simply wait for 0xFE before reading in the reply (because it may never arrive, or may be part of the actual reply data).I wonder if anyone has a better way to deal with all replies than my current solution, which is to calculate the checksum from each of a few start offsets, until it’s correct.Cheers.

author: @rt
author_rank: Super Contributor
timestamp: November 23, 2018, 06:42:55 am
content: Hmm... typing it out, it just occurred to me that a particular card might need a delay between the request, and it’s reply.Clocking it with SPI just might result in 0xFF (or set bits) before the card has really started sending it’s reply.

author: thm_w
author_rank: Super Contributor
timestamp: November 23, 2018, 09:37:27 pm
content: Are you referring to initialization or a normal response timing?Its possible they are violating spec and need a delay or aren't waiting long enough for a valid response, it helps to have a logic analyzer to check.Quotehttp://users.ece.utexas.edu/~valvano/EE345M/SD_Physical_Layer_Spec.pdf(simple spec)https://web.archive.org/web/20131115122620/http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Components/General/SDSpec.pdf(full)

author: @rt
author_rank: Super Contributor
timestamp: November 24, 2018, 04:20:26 pm
content: Hi,The initialisation is working. It would only mess up some particular information if the CID register values weren’t parsed properly.Basically if you send CMD10 to the card, the reply would normally be:Code:0xFE, CID REGISTER CONTENTS, CS.For some cards it could just be:Code:CID REGISTER CONTENTS, CS.I have not seen the above, but have seen code that deals with that possibility,and also mentioned int he source comments.For Samsung cards in particular (personally tested by me), I get:Code:0xFF, 0xFE, CID REGISTER CONTENTS, CS.There are plenty of easy ways to deal with it, but it makes me wonder how such cards were introduced,and existing software that requested the CID register dealt with it.It makes me consider that I’m doing something wrong, but also suspicious that it’s only a particular brand card.
Vivado and Hard Macros - Page 1
Forum section: electronics / general

author: 0culus
author_rank: Super Contributor
timestamp: November 21, 2018, 05:29:26 am
content: So I'm working on a project that uses a Xilinx Spartan-7 FPGA. I need to have a piece of the project be written as a hard macro so that it never changes place and route when instantiated later with other logic. I see lots of resources for writing hard macros in ISE, but it seems Vivado has dumped that feature?Is there a more idiomatic way to achieve this in Vivado? Perhaps I can export my design as an IP core somehow?Thanks!

author: scatha
author_rank: Regular Contributor
timestamp: November 22, 2018, 10:16:32 am
content: I never used the hard macro feature in ISE but you can do something similar in Vivado using pblocks. The general workflow I've used is:- Synthesis the design- Create an appropriately-sized pblock with the EXCLUDE_PLACEMENT and CONTAIN_ROUTING directives set (these stop other parts of the design being placed or routed through the pblock)- Assign the appropriate cells to the pblock then complete the design implementation- Once complete, extract the cell placement within the pblock- Next time you need the block, recreate the pblock and create an identical placement within it (using place_cells) post-synthesis.Most of this requires tcl scripting. There might be a better way of doing this using the partial reconfiguration workflow, though.

author: legacy
author_rank: Super Contributor
timestamp: November 22, 2018, 01:04:15 pm
content: what do you usually do with these macros?

author: 0culus
author_rank: Super Contributor
timestamp: November 24, 2018, 03:49:55 am
content: Quote from: scatha on November 22, 2018, 10:16:32 amThanks! I think partial reconfiguration may be locked behind the very expensive paywall...I'm just using the free version. I'll take a look at pblocks.Quote from: legacy on November 22, 2018, 01:04:15 pmMy understanding is that it is normally used to ensure that a design can be used over and over again while maintaining the same placement and routing. This might be because you had to hand optimize the timing and don't want the tools to dick that up or it's a circuit that's sensitive to changes, and you want it to remain in exactly the same state. My project is the latter.

author: legacy
author_rank: Super Contributor
timestamp: November 24, 2018, 02:27:27 pm
content: With ISE I use two UCF files: one for the pinout-mapping & electrical constraints, one for the timing constraints.
Attaching a FIFO to a backplane register interface - Page 1
Forum section: electronics / general

author: nickolas
author_rank: Newbie
timestamp: November 24, 2018, 03:51:57 am
content: Hello All,I designed a rudimentary back plane that has ~50 parallel pins. Currently, 8 pins are for the address line, 8 pins are for the data lines, 1 pin is for a clock, and 1 pin is for a not Read/Write command.These pins go into an FPGA where each register compares the address with its own address as a select, and then depending upon not read/write command, inputs or outputs the data. I have tested reading/writing a few registers and it works fine. I am now looking to have read registers where the user can read data from a FIFO. Is there a standard approach to attaching a FIFO as a read register on an interface such as this?Thanks for you help.

author: hamster_nz
author_rank: Super Contributor
timestamp: November 24, 2018, 03:55:25 am
content: Usually you have an 'output enable' line too.You need something to tell the FPGA when to drive or release the data bus.For a FIFO you may need two registers. One to read the status of the FIFO, the other to read the data.

author: nickolas
author_rank: Newbie
timestamp: November 24, 2018, 04:41:26 am
content: Yes, eventually, I was going to beef up the protocol, but wanted to stay as simple as I could until I get some preliminary info about the hardware design (ADC samples at 100 MHz, so I wanted to look at some Bode plots of the analog frontend and try to quantify some stuff about it before revising the PCB design). I can add an output enable line quickly now though.The question really is about how to get data from the FIFO. Should I use the FIFO itself as a register connected in parallel with the other read/read-write registers within the FPGA or should I create a register than gets filled with the most recent result from the FIFO until the next read occurs?I have a status register currently that just sees if the FIFO is full or empty, but will add more to this later.
PIC18F46K42 xpress EVAL Board - UART - Page 1
Forum section: electronics / general

author: arul
author_rank: Regular Contributor
timestamp: November 23, 2018, 02:56:38 pm
content: Hi,I am developing one of the UART program using MPLAB Xpress PIC18F46K42 evaluation board on MPLAB CLOUD IDE.In this program, FT232R USB UART IC and termite app are used to estabish the communication.In this case, the LED is 'ON' and 'OFF', but the UART function is not established on termite window.my code is as follows:////////////////main function/////////////void main(void){PORTAbits.RA0 = 1; //led "ON"delay_ms(100) ; //wait for delayUART1_Write(a); ////char (or) uint8_t a = 77;UART1_Write(b); ////char (or) uint8_t b = 78;UART1_Write(c); ////char (or) uint8_t c = 79;UART1_Write(d); ////char (or) uint8_t d = 80;PORTAbits.RA0 = 0; //led "OFF"delay_ms(100) ; //wait for delay}////////UART Transmit function///////////void UART1_Write(uint8_t txData){while(0 == uart1TxBufferRemaining){}if(0 == PIE3bits.U1TXIE){U1TXB = txData;}else{PIE3bits.U1TXIE = 0;uart1TxBuffer[uart1TxHead++] = txData;if(sizeof(uart1TxBuffer) <= uart1TxHead){uart1TxHead = 0;}uart1TxBufferRemaining--;}PIE3bits.U1TXIE = 1;}////////////////////////////////////Please let me know, what is going wrong...

author: JPortici
author_rank: Super Contributor
timestamp: November 23, 2018, 03:01:02 pm
content: Please use code tags.I don't see where the hardware is being initialized.

author: arul
author_rank: Regular Contributor
timestamp: November 24, 2018, 04:28:06 am
content: Hi JPortici,These are hardware intialization:#define IO_RA0_PORT PORTAbits.RA0 ///led initializationTRISA = 0xFE; ///led initialization#define RC6_GetValue() PORTCbits.RC6 ///tx initializationTRISC = 0xBF; ///tx initializationRC6PPS = 0x13; //RC6->UART1:TX1; ///tx initialization#define RC7_GetValue() PORTCbits.RC7 ///rx initializationU1RXPPS = 0x17; //RC7->UART1:RX1; ///rx initialization
What name does this board package have? - Page 1
Forum section: electronics / general

author: sangar
author_rank: Regular Contributor
timestamp: November 22, 2018, 06:17:18 pm
content: Hi,I am trying to find out the name of the package of the attached board...My colleague said that it is a kind of LGA package...Please suggest the universal name of it...Thanks,Muthu

author: analogo
author_rank: Regular Contributor
timestamp: November 22, 2018, 06:30:18 pm
content: Those are castellated mounting holes. The board is a castellated board.https://learn.sparkfun.com/tutorials/how-to-solder-castellated-mounting-holes/all

author: chrisl
author_rank: Regular Contributor
timestamp: November 22, 2018, 10:23:55 pm
content: CASTELLATED HOLES/VIAShttps://prototypepcb.com/castellated-holes/
CLion IDE is gaining remote target support - Page 1
Forum section: electronics / general

author: nfmax
author_rank: Super Contributor
timestamp: September 25, 2018, 09:36:02 am
content: The CLion C/C++ IDE from JetBrainshttps://jetbrains.com/clionis based on the IntelliJ/IDEA core: it is one of a number of variants supporting different languages. The 2018.3 Early-Access Preview released on Sept 19th adds initial support for remote target operation. The IDE itself and the project source code live on the host machine (PC, laptop) and are downloaded to the target for build, compilation and debugging, using the host as the debug UI. At the same time, the target header files etc., are uploaded to the host, so they can be used to provide IDE 'intelligence' (e.g. showing function parameters, auto-completion hints).Currently the host has to be Unix-like (Linux or Mac), and the target has to be Linux, with installed supported compiler, debugger, make, rsync, & CMake. I have used it to develop on a Raspberry Pi running Raspbian, from a Mac host, and the experience has been OK, albeit still with a few rough edges.The Early Access Programhttps://www.jetbrains.com/clion/nextversion/is free to join (CLion is normally annually licensed, for a range of prices including free, depending on the customer & application) so if you feel inclined to try it out, give it a go!Disclaimer: I am a JetBrains customer (personal license for the full suite) but not otherwise associated with the company

author: NivagSwerdna
author_rank: Super Contributor
timestamp: September 25, 2018, 09:40:45 am
content: There is an amazing deal for students, that includes CLion,https://education.github.com/pack

author: nfmax
author_rank: Super Contributor
timestamp: November 28, 2018, 09:51:44 pm
content: CLion 2018.3 is now released

author: Dielectric
author_rank: Regular Contributor
timestamp: November 29, 2018, 01:33:07 am
content: Cool. Remote debugging is what finally got me to open my wallet for PyCharm Pro (CLion for Python or however you want to look at it). Great tool, excellent mouthfeel.
Bought some no-name curcuit board, dont know how to use it. Complete beginner. - Page 1
Forum section: electronics / general

author: chevap
author_rank: Newbie
timestamp: November 22, 2018, 09:04:15 am
content: Hi,I bought a vibrating wire sensor measurement module over aliexpress. I am trying to make my own vibrating wire sensor measurement unit, to read signals from vibrating wire unit such as piezometer. I have no information about the board except that is "Model: WIN311, IN VCC: 5V, OUTPUT: RS232". All serials and info on the chips were erased by the board manufacturer. I would like to somehow connect to this board via some application and find out more info on microcontroller type on this board. Any idea on how to connect to a unknown circuit board, and where to begin on using it? I tried with Realterm terminal but dont know how to send commands to board, to get some respond from it. I have board connected to a 5V power supply via modified usb cable and data connection to computer via RS232 connector.Info of the vibrating wire sensor measurement module, pictures of circuit board layout:https://it.aliexpress.com/item/Vibr...re-Reading-Instrument-WIN311/32571113342.html

author: TomS_
author_rank: Frequent Contributor
timestamp: November 22, 2018, 02:00:52 pm
content: Start with Google and see what you can find, that would be my first step.Perhaps others have used the board and have sample projects based on it, and maybe you find some libraries to at least give you some insight in to how to communicate with it.Otherwise, look for similar boards that appear to use similar chips (package, pins etc). Download the datasheet for the chips used on those boards. Compare pinouts and circuitry. If they appear to be the same, try sending commands based on the documentation on the datasheets you have. Like many Hitachi clone LCD controllers, if the chip and/or its protocol is popular, then there is a more than zero probability that the protocol has also been copied.