out-cs-bim 112 delay on start

Fragen und Diskussionen zu den Geräten. Sowohl Hardware als auch Software. English is welcome.
pete68
Beiträge: 57
Registriert: 14. Jun 2015, 10:12

Re: out-cs-bim 112 delay on start

Beitrag von pete68 »

I understand, but then how can you set a long delay?

Tags:
gnampf
Beiträge: 13
Registriert: 5. Mär 2021, 09:56

Re: out-cs-bim 112 delay on start

Beitrag von gnampf »

So this seems to be a bug, it should then wait 1000 * msec.
But calling delay from inside an IRQ isn't a great idea anyways, as all other IRQs are blocked by that also. If the IRQ has to wait, it would better reactive other IRQs (if thats possible on the ARM), which would also reenable the timer irq, or hand the action over to the main loop by setting some flag.
Calling it from outside an IRQ should'nt be a problem, even if there are IRQs pending (which you wouldn't notice, as they then would have get called). But of course it would be a problem if IRQs are disabled, and so the timer irq would not work. I'm not sure if IRQs are already enabled in setup?
Mirko
Beiträge: 118
Registriert: 13. Feb 2015, 15:41

Re: out-cs-bim 112 delay on start

Beitrag von Mirko »

@gnampf: I agree that this is a bug, but 1000*msec would not work reliably because delayMicroseconds() takes an unsigned int but uses signed int internally. So the maximum delay could be 44739ms. We should discuss this more in depth in Slack.
Mirko
Beiträge: 118
Registriert: 13. Feb 2015, 15:41

Re: out-cs-bim 112 delay on start

Beitrag von Mirko »

@pete68: Please try delayMicroseconds(10000000). This should work for usec < 44,739,244 for now.
Darthyson
Beiträge: 55
Registriert: 3. Sep 2020, 14:03

Re: out-cs-bim 112 delay on start

Beitrag von Darthyson »

Hello pete68,
pete68 hat geschrieben: 24. Sep 2021, 17:00 I had to modify the original project to use monostable relays. something is obviously wrong.
It would be quite helpful, if you could provide your code changes as a *.patch file or your changed .cpp/.h files.
AFAIK, the out-cs-bim112 only supports bi-stable relays.

I just tested in out-cs-bim112 -> app_main.cpp:

Code: Alles auswählen

void setup()
{
 delay(10000); //wait 10 seconds
 for (unsigned ipno=0; ipno<8; ipno++)
which worked as excpected, but is not the best place for a delay.
A better solution would be to change in config.h

Code: Alles auswählen

#define STARTUPWAITTIME 1000
(milliseconds)

Greetings
Denis
ETS 5.7.4 (Build 1093), Gira IP-Router 103000, MCUXpresso IDE v11.4.1 [Build 6260], Windows 10 Version 21H1
3x in16-bim112 ARM | 2x rol-jal-bim112 ARM | 8x Kombisensor LPC | 1x out8 LPC | 2x 2in2out LPC | 2x 8IN LPC
Darthyson
Beiträge: 55
Registriert: 3. Sep 2020, 14:03

Re: out-cs-bim 112 delay on start

Beitrag von Darthyson »

Hello pete68,

is this the problem you want to fix with delay() ?
pete68 hat geschrieben: 8. Jul 2019, 11:26 ...noticed a strange behavior in my modified circuit for monostable relays,...
Greetings
Denis
ETS 5.7.4 (Build 1093), Gira IP-Router 103000, MCUXpresso IDE v11.4.1 [Build 6260], Windows 10 Version 21H1
3x in16-bim112 ARM | 2x rol-jal-bim112 ARM | 8x Kombisensor LPC | 1x out8 LPC | 2x 2in2out LPC | 2x 8IN LPC
Antworten